getValueSetSeparator() returns ',' for type_user and type_group

This commit is contained in:
Uwe Steinmann 2020-09-01 14:59:16 +02:00
parent 96d89a76b7
commit ce2ee995fc

View File

@ -168,6 +168,7 @@ class SeedDMS_Core_Attribute { /* {{{ */
if(is_array($values)) { if(is_array($values)) {
if($values) { if($values) {
$vsep = $this->getValueSetSeparator();
if($valueset) { if($valueset) {
$error = false; $error = false;
foreach($values as $v) { foreach($values as $v) {
@ -176,9 +177,9 @@ class SeedDMS_Core_Attribute { /* {{{ */
if($error) if($error)
return false; return false;
$valuesetstr = $this->_attrdef->getValueSet(); $valuesetstr = $this->_attrdef->getValueSet();
$value = $valuesetstr[0].implode($valuesetstr[0], $values); $value = $vsep.implode($vsep, $values);
} else { } else {
$value = ','.implode(',', $values); $value = $vsep.implode($vsep, $values);
} }
} else { } else {
$value = ''; $value = '';
@ -649,10 +650,16 @@ class SeedDMS_Core_AttributeDefinition { /* {{{ */
* @return string separator or an empty string if a value set is not set * @return string separator or an empty string if a value set is not set
*/ */
function getValueSetSeparator() { /* {{{ */ function getValueSetSeparator() { /* {{{ */
if(strlen($this->_valueset) > 1) if(strlen($this->_valueset) > 1) {
return $this->_valueset[0]; return $this->_valueset[0];
} elseif($this->_multiple) {
if($this->_type == SeedDMS_Core_AttributeDefinition::type_user || $this->_type == SeedDMS_Core_AttributeDefinition::type_group)
return ',';
else else
return ''; return '';
} else {
return '';
}
} /* }}} */ } /* }}} */
/** /**