mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-17 14:28:53 +02:00
N°931: Import/Export separator defined in configuration
This commit is contained in:
@@ -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}";
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user