mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-24 02:58:43 +02:00
CSV import/export reworked:
Trac #174 and #283: import.php localized by default, option no_localize to disable Trac #554: export.php localized by default, option no_localize to disable Trac #555: friendlyname abusively used as a reconciliation key + Default charset is ISO-8859-1 to be compatible with Excel (See config parameter csv_file_default_charset) + CSV export in UTF-8 with BOM to help Excel in getting it right (not all versions) + Fixed reporting issues (wrong class, exceptions, changed external key) + Fixed settings lost when navigating in the import wizard + Fixed issues when some html entities were found in the data (reporting + export) + Added a link to download the CSV export.php SVN:trunk[2253]
This commit is contained in:
@@ -907,11 +907,45 @@ abstract class MetaModel
|
||||
}
|
||||
|
||||
|
||||
public static function GetLabel($sClass, $sAttCode)
|
||||
/**
|
||||
* Get the attribute label
|
||||
* @param string sClass Persistent class
|
||||
* @param string sAttCodeEx Extended attribute code: attcode[->attcode]
|
||||
* @return string A user friendly format of the string: AttributeName or AttributeName->ExtAttributeName
|
||||
*/
|
||||
public static function GetLabel($sClass, $sAttCodeEx)
|
||||
{
|
||||
$oAttDef = self::GetAttributeDef($sClass, $sAttCode);
|
||||
if ($oAttDef) return $oAttDef->GetLabel();
|
||||
return "";
|
||||
$sLabel = '';
|
||||
if (preg_match('/(.+)->(.+)/', $sAttCodeEx, $aMatches) > 0)
|
||||
{
|
||||
$sAttribute = $aMatches[1];
|
||||
$sField = $aMatches[2];
|
||||
$oAttDef = MetaModel::GetAttributeDef($sClass, $sAttribute);
|
||||
if ($oAttDef->IsExternalKey())
|
||||
{
|
||||
$sTargetClass = $oAttDef->GetTargetClass();
|
||||
$oTargetAttDef = MetaModel::GetAttributeDef($sTargetClass, $sField);
|
||||
$sLabel = $oAttDef->GetLabel().'->'.$oTargetAttDef->GetLabel();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Let's return something displayable... but this should never happen!
|
||||
$sLabel = $oAttDef->GetLabel().'->'.$aMatches[2];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($sAttCodeEx == 'id')
|
||||
{
|
||||
$sLabel = Dict::S('UI:CSVImport:idField');
|
||||
}
|
||||
else
|
||||
{
|
||||
$oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCodeEx);
|
||||
$sLabel = $oAttDef->GetLabel();
|
||||
}
|
||||
}
|
||||
return $sLabel;
|
||||
}
|
||||
|
||||
public static function GetDescription($sClass, $sAttCode)
|
||||
|
||||
Reference in New Issue
Block a user