Fixed Trac #492: bulk modify resets the linksets

SVN:1.1[1631]
This commit is contained in:
Denis Flaven
2011-10-12 19:44:40 +00:00
parent b732673b65
commit 8fe5450d9e
2 changed files with 23 additions and 2 deletions

View File

@@ -1862,7 +1862,7 @@ EOF
return $aDetails;
}
protected static function FlattenZList($aList)
public static function FlattenZList($aList)
{
$aResult = array();
foreach($aList as $value)

View File

@@ -920,10 +920,31 @@ EOF
$iChangeId = $oMyChange->DBInsert();
utils::RemoveTransaction($sTransactionId);
}
// Explicitely build the list of attributes to update since we do NOT update the linksets
// because they are not part of the form
$aAttList = cmdbAbstractObject::FlattenZList(MetaModel::GetZListItems($sClass, 'details'));
foreach($aAttList as $index => $sAttCode)
{
$oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode);
if ($oAttDef->IsLinkset())
{
unset($aAttList[$index]);
}
}
// Special case to process the case log, if any...
// WARNING: if you change this also check the functions DisplayModifyForm and DisplayCaseLog
foreach(MetaModel::ListAttributeDefs($sClass) as $sAttCode => $oAttDef)
{
if ($oAttDef instanceof AttributeCaseLog)
{
$aAttList[] = $sAttCode;
}
}
foreach($aSelectedObj as $iId)
{
$oObj = MetaModel::GetObject($sClass, $iId);
$aErrors = $oObj->UpdateObject('');
$aErrors = $oObj->UpdateObject('', $aAttList);
$bResult = (count($aErrors) == 0);
if ($bResult)
{