');
+ foreach($aCols as $sColIndex => $aFieldsets)
{
- if ($oAttDef->IsWritable())
+ $oPage->add('
');
+ //$aDetails[$sTab][$sColIndex] = array();
+ foreach($aFieldsets as $sFieldsetName => $aFields)
{
- if ($sStateAttCode == $sAttCode)
+ $aDetails[$sTab][$sColIndex] = array();
+ if (!empty($sFieldsetName))
{
- // State attribute is always read-only from the UI
- $sHTMLValue = $this->GetStateLabel();
- $aDetails[] = array('label' => $oAttDef->GetLabel(), 'value' => $sHTMLValue);
+ $oPage->add('');
}
}
- else
- {
- $aDetails[] = array('label' => ''.$oAttDef->GetLabel().'', 'value' => $this->GetAsHTML($sAttCode));
- }
+ $oPage->add('
');
}
+ $oPage->add('
');
}
- $oPage->details($aDetails);
+
// Now display the relations, one tab per relation
$this->DisplayBareRelations($oPage, true); // Edit mode
@@ -1413,7 +1468,7 @@ EOF
}
else
{
- $aResult = array_merge($aResult, $this->FlattenZList($value));
+ $aResult = array_merge($aResult,self::FlattenZList($value));
}
}
return $aResult;
diff --git a/pages/ajax.csvimport.php b/pages/ajax.csvimport.php
index ef9ecf72e..b5d78e38b 100644
--- a/pages/ajax.csvimport.php
+++ b/pages/ajax.csvimport.php
@@ -104,6 +104,13 @@ function GetMappingForField($sClassName, $sFieldName, $iFieldIndex, $bAdvancedMo
$aChoices = array('' => Dict::S('UI:CSVImport:MappingSelectOne'));
$aChoices[':none:'] = Dict::S('UI:CSVImport:MappingNotApplicable');
$sFieldCode = ''; // Code of the attribute, if there is a match
+ $aMatches = array();
+ if (preg_match('/^(.+)\*$/', $sFieldName, $aMatches))
+ {
+ // Remove any trailing "star" character.
+ // A star character at the end can be used to indicate a mandatory field
+ $sFieldName = $aMatches[1];
+ }
if ($sFieldName == 'id')
{
$sFieldCode = 'id';
@@ -114,6 +121,7 @@ function GetMappingForField($sClassName, $sFieldName, $iFieldIndex, $bAdvancedMo
}
foreach(MetaModel::ListAttributeDefs($sClassName) as $sAttCode => $oAttDef)
{
+ $sStar = '';
if ($oAttDef->IsExternalKey())
{
if ( ($sFieldName == $oAttDef->GetLabel()) || ($sFieldName == $sAttCode))
@@ -124,6 +132,11 @@ function GetMappingForField($sClassName, $sFieldName, $iFieldIndex, $bAdvancedMo
{
$aChoices[$sAttCode] = $oAttDef->GetLabel();
}
+ $oExtKeyAttDef = MetaModel::GetAttributeDef($sClassName, $oAttDef->GetKeyAttCode());
+ if (!$oExtKeyAttDef->IsNullAllowed())
+ {
+ $sStar = '*';
+ }
// Get fields of the external class that are considered as reconciliation keys
$sTargetClass = $oAttDef->GetTargetClass();
foreach(MetaModel::ListAttributeDefs($sTargetClass) as $sTargetAttCode => $oTargetAttDef)
@@ -140,7 +153,7 @@ function GetMappingForField($sClassName, $sFieldName, $iFieldIndex, $bAdvancedMo
{
// When not in advanced mode do not allow to use reconciliation keys (on external keys) if they are themselves external keys !
- $aChoices[$sAttCode.'->'.$sTargetAttCode] = $oAttDef->GetLabel().'->'.$oTargetAttDef->GetLabel().$sSuffix;
+ $aChoices[$sAttCode.'->'.$sTargetAttCode] = $oAttDef->GetLabel().'->'.$oTargetAttDef->GetLabel().$sSuffix.$sStar;
if ((strcasecmp($sFieldName, $aChoices[$sAttCode.'->'.$sTargetAttCode]) == 0) || (strcasecmp($sFieldName, ($sAttCode.'->'.$sTargetAttCode.$sSuffix)) == 0) )
{
$sFieldCode = $sAttCode.'->'.$sTargetAttCode;
@@ -151,7 +164,11 @@ function GetMappingForField($sClassName, $sFieldName, $iFieldIndex, $bAdvancedMo
}
else if ( ($oAttDef->IsWritable()) && (!$oAttDef->IsLinkSet()) )
{
- $aChoices[$sAttCode] = $oAttDef->GetLabel();
+ if (!$oAttDef->IsNullAllowed())
+ {
+ $sStar = '*';
+ }
+ $aChoices[$sAttCode] = $oAttDef->GetLabel().$sStar;
if ( ($sFieldName == $oAttDef->GetLabel()) || ($sFieldName == $sAttCode))
{
$sFieldCode = $sAttCode;
@@ -356,7 +373,7 @@ EOF
$oSearch = new DBObjectSearch($sClassName);
$oSearch->AddCondition('id', 0, '='); // Make sure we create an empty set
$oSet = new CMDBObjectSet($oSearch);
- $sResult = cmdbAbstractObject::GetSetAsCSV($oSet);
+ $sResult = cmdbAbstractObject::GetSetAsCSV($oSet, array('showMandatoryFields' => true));
//$aCSV = explode("\n", $sCSV);
// If there are more than one line, let's assume that the first line is a comment and skip it.
//if (count($aCSV) > 1)
diff --git a/webservices/import.php b/webservices/import.php
index 89998fb16..9b1009a85 100644
--- a/webservices/import.php
+++ b/webservices/import.php
@@ -279,6 +279,12 @@ try
$aExtKeys = array();
foreach($aRawFieldList as $iFieldId => $sFieldName)
{
+ $aMatches = array();
+ if (preg_match('/^(.+)\*$/', $sFieldName, $aMatches))
+ {
+ // Ignore any trailing "star" (*) that simply indicates a mandatory field
+ $sFieldName = $aMatches[1];
+ }
if (preg_match('/^(.*)->(.*)$/', trim($sFieldName), $aMatches))
{
// The column has been specified as "extkey->attcode"