N°4157 - Relations, modify one and add it again fails, the adding is ignored - Dont-work. It's a idee to solve the problem of display modified link, but actually there is a js bug.

This commit is contained in:
acognet
2022-07-08 12:24:53 +02:00
parent 5a77159ece
commit c7eea3f51f
4 changed files with 104 additions and 121 deletions

View File

@@ -605,16 +605,32 @@ class ormLinkSet implements iDBObjectSetIterator, Iterator, SeekableIterator
$aAdded = $this->aAdded;
$aModified = $this->aModified;
$aRemoved = array();
if (count($this->aRemoved) > 0)
{
if (count($this->aRemoved) > 0) {
$oSearch = new DBObjectSearch($this->sClass);
$oSearch->AddCondition('id', $this->aRemoved, 'IN');
$oSet = new DBObjectSet($oSearch);
$aRemoved = $oSet->ToArray();
}
return array_merge($aAdded, $aModified, $aRemoved);
}
/**
* Get the list of all modified (added, modified and removed) links
*
* @return array of link objects
* @throws \Exception
*/
public function GetModified($sExtKeyToMe)
{
$aModified = [];
foreach ($this->aModified as $oObj) {
$aModified[$oObj->GetKey()] = $oObj->Get($sExtKeyToMe);
}
return $aModified;
}
/**
* @param DBObject $oHostObject
*
@@ -658,8 +674,7 @@ class ormLinkSet implements iDBObjectSetIterator, Iterator, SeekableIterator
{
$aCheckLinks[] = $iLinkId;
}
foreach ($this->aModified as $iLinkId => $oLink)
{
foreach ($this->aModified as $iLinkId => $oLink) {
$aCheckLinks[] = $oLink->GetKey();
}
@@ -695,8 +710,7 @@ class ormLinkSet implements iDBObjectSetIterator, Iterator, SeekableIterator
// Write the links according to the existing links
//
foreach ($this->aAdded as $oLink)
{
foreach ($this->aAdded as $oLink) {
// Make sure that the objects in the set point to "this"
$oLink->Set($sExtKeyToMe, $oHostObject->GetKey());