diff --git a/core/attributedef.class.inc.php b/core/attributedef.class.inc.php index bf8e3e6c6..d59599280 100644 --- a/core/attributedef.class.inc.php +++ b/core/attributedef.class.inc.php @@ -1135,7 +1135,7 @@ class AttributeLinkedSet extends AttributeDefinition } // Both values are Object sets - return $val1->HasSameContents($val2, array($this->GetExtKeyToMe())); + return $val1->HasSameContents($val2); } /** diff --git a/core/dbobject.class.php b/core/dbobject.class.php index 788ed15d8..b4889da34 100644 --- a/core/dbobject.class.php +++ b/core/dbobject.class.php @@ -1384,24 +1384,13 @@ abstract class DBObject implements iDisplay foreach($aChanges['modified'] as $oLink) { - // Make sure that the objects in the set point to "this" - $oLink->Set($oAttDef->GetExtKeyToMe(), $this->m_iKey); + // Objects in the set either remain attached or have been detached -> leave the link as is $oLink->DBWrite(); } foreach($aChanges['removed'] as $oLink) { - // Objects can be removed from the set because: - // 1) They should no longer exist - // 2) They are about to be removed from the set BUT NOT deleted, their ExtKey has been reset - if ($oLink->IsModified() && ($oLink->Get($sExtKeyToMe) != $this->m_iKey)) - { - $oLink->DBWrite(); - } - else - { - $oLink->DBDelete(); - } + $oLink->DBDelete(); } } } diff --git a/core/dbobjectset.class.php b/core/dbobjectset.class.php index 90b5f445c..b716d3349 100644 --- a/core/dbobjectset.class.php +++ b/core/dbobjectset.class.php @@ -1318,7 +1318,7 @@ class DBObjectSetComparator // Already marked as modified above //$aResult['modified'][$oObj->GetKey()] = $oObj; } - else if (!array_key_exists($sFingerprint, $this->aFingerprints1) && $oObj->IsNew()) + else if (!array_key_exists($sFingerprint, $this->aFingerprints1)) { $aResult['added'][] = $oObj; }