mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-20 00:58:48 +02:00
N°5904 - Fix crash when adding a 1:n link item in object edition
This commit is contained in:
@@ -4021,8 +4021,16 @@ HTML;
|
||||
if (($sLinkedClass == $sSubClass) || (is_subclass_of($sSubClass, $sLinkedClass))) {
|
||||
$aObjData = $aData['data'];
|
||||
// Avoid duplicates on bulk modify
|
||||
if (!in_array($aObjData[$oAttDef->GetExtKeyToRemote()], $oLinkSet->GetColumnAsArray($oAttDef->GetExtKeyToRemote(), false))
|
||||
|| $oAttDef->DuplicatesAllowed()) {
|
||||
$bCanLinkBeCreated = true;
|
||||
// - Special case for n:n links
|
||||
if (
|
||||
($oAttDef instanceof AttributeLinkedSetIndirect)
|
||||
&& (false === $oAttDef->DuplicatesAllowed())
|
||||
&& in_array($aObjData[$oAttDef->GetExtKeyToRemote()], $oLinkSet->GetColumnAsArray($oAttDef->GetExtKeyToRemote(), false))
|
||||
) {
|
||||
$bCanLinkBeCreated = false;
|
||||
}
|
||||
if ($bCanLinkBeCreated) {
|
||||
$oLink = MetaModel::NewObject($sSubClass);
|
||||
$oLink->UpdateObjectFromArray($aObjData);
|
||||
$oLinkSet->AddItem($oLink);
|
||||
|
||||
Reference in New Issue
Block a user