diff --git a/core/attributedef.class.inc.php b/core/attributedef.class.inc.php index 4c4073c9e..f2ce8894b 100644 --- a/core/attributedef.class.inc.php +++ b/core/attributedef.class.inc.php @@ -6052,10 +6052,14 @@ class AttributeTagSet extends AttributeDBFieldVoid */ public function MakeValueFromString($sProposedValue, $bLocalizedValue = false, $sSepItem = null, $sSepAttribute = null, $sSepValue = null, $sAttributeQualifier = null) { + if (is_null($sSepItem) || empty($sSepItem)) + { + $sSepItem = MetaModel::GetConfig()->Get('tag_set_item_separator'); + } if ($bLocalizedValue && !empty($sProposedValue)) { $oTagSet = new ormTagSet(MetaModel::GetAttributeOrigin($this->GetHostClass(), $this->GetCode()), $this->GetCode()); - $aLabels = explode('|', $sProposedValue); + $aLabels = explode($sSepItem, $sProposedValue); $aCodes = array(); foreach($aLabels as $sTagLabel) { @@ -6277,6 +6281,7 @@ class AttributeTagSet extends AttributeDBFieldVoid */ public function GetAsCSV($value, $sSeparator = ',', $sTextQualifier = '"', $oHostObject = null, $bLocalize = true, $bConvertToPlainText = false) { + $sSepItem = MetaModel::GetConfig()->Get('tag_set_item_separator'); if (is_object($value) && ($value instanceof ormTagSet)) { if ($bLocalize) @@ -6287,13 +6292,13 @@ class AttributeTagSet extends AttributeDBFieldVoid { $aValues = $value->GetValue(); } - $sRes = implode('|', $aValues); + $sRes = implode($sSepItem, $aValues); } else { $sRes = ''; } - return $sRes; + return "{$sTextQualifier}{$sRes}{$sTextQualifier}"; } /** diff --git a/core/config.class.inc.php b/core/config.class.inc.php index 4cdb28667..154a67446 100644 --- a/core/config.class.inc.php +++ b/core/config.class.inc.php @@ -408,6 +408,14 @@ class Config 'source_of_value' => '', 'show_in_conf_sample' => true, ), + 'tag_set_item_separator' => array( + 'type' => 'string', + 'description' => 'Tag set from string: tag label separator', + 'default' => '|', + 'value' => '|', + 'source_of_value' => '', + 'show_in_conf_sample' => true, + ), 'cron_max_execution_time' => array( 'type' => 'integer', 'description' => 'Duration (seconds) of the page cron.php, must be shorter than php setting max_execution_time and shorter than the web server response timeout',