mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-24 11:08:45 +02:00
N°1109 - itop-object-copier Create ticket from CI was not adding the CI in the CI list of the newly created ticket.
* Fix 'add_to_list' command. * Fix Adding a n-n link at the creation time. SVN:trunk[5053]
This commit is contained in:
@@ -409,26 +409,8 @@ EOF
|
|||||||
$sLinkedClass = $oAttDef->GetLinkedClass();
|
$sLinkedClass = $oAttDef->GetLinkedClass();
|
||||||
|
|
||||||
// Filter out links pointing to obsolete objects (if relevant)
|
// Filter out links pointing to obsolete objects (if relevant)
|
||||||
$oLinkSearch = $this->Get($sAttCode)->GetFilter();
|
$oOrmLinkSet = $this->Get($sAttCode);
|
||||||
if ($oAttDef->IsIndirect())
|
$oLinkSet = $oOrmLinkSet->ToDBObjectSet(utils::ShowObsoleteData());
|
||||||
{
|
|
||||||
$sExtKeyToRemote = $oAttDef->GetExtKeyToRemote();
|
|
||||||
$oLinkingAttDef = MetaModel::GetAttributeDef($sLinkedClass, $sExtKeyToRemote);
|
|
||||||
$sTargetClass = $oLinkingAttDef->GetTargetClass();
|
|
||||||
if (!utils::ShowObsoleteData() && MetaModel::IsObsoletable($sTargetClass))
|
|
||||||
{
|
|
||||||
$oNotObsolete = new BinaryExpression(
|
|
||||||
new FieldExpression('obsolescence_flag', $sTargetClass),
|
|
||||||
'=',
|
|
||||||
new ScalarExpression(0)
|
|
||||||
);
|
|
||||||
$oNotObsoleteRemote = new DBObjectSearch($sTargetClass);
|
|
||||||
$oNotObsoleteRemote->AddConditionExpression($oNotObsolete);
|
|
||||||
$oLinkSearch->AddCondition_PointingTo($oNotObsoleteRemote, $sExtKeyToRemote);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$oLinkSet = new DBObjectSet($oLinkSearch);
|
|
||||||
$oLinkSet->SetShowObsoleteData(utils::ShowObsoleteData());
|
|
||||||
|
|
||||||
$iCount = $oLinkSet->Count();
|
$iCount = $oLinkSet->Count();
|
||||||
$sCount = '';
|
$sCount = '';
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ class UILinksWidget
|
|||||||
$sPrefix .= "[-$iUniqueId][";
|
$sPrefix .= "[-$iUniqueId][";
|
||||||
$sNameSuffix = "]"; // To make a tabular form
|
$sNameSuffix = "]"; // To make a tabular form
|
||||||
$aArgs['prefix'] = $sPrefix;
|
$aArgs['prefix'] = $sPrefix;
|
||||||
$aArgs['wizHelper'] = "oWizardHelper{$this->m_iInputId}_".$iUniqueId;
|
$aArgs['wizHelper'] = "oWizardHelper{$this->m_iInputId}_".($iUniqueId < 0 ? -$iUniqueId : $iUniqueId);
|
||||||
$aArgs['this'] = $oNewLinkObj;
|
$aArgs['this'] = $oNewLinkObj;
|
||||||
$aRow['form::checkbox'] = "<input class=\"selection\" data-remote-id=\"$iRemoteObjKey\" data-link-id=\"\" data-unique-id=\"$iUniqueId\" type=\"checkbox\" onClick=\"oWidget".$this->m_iInputId.".OnSelectChange();\" value=\"-$iUniqueId\">";
|
$aRow['form::checkbox'] = "<input class=\"selection\" data-remote-id=\"$iRemoteObjKey\" data-link-id=\"\" data-unique-id=\"$iUniqueId\" type=\"checkbox\" onClick=\"oWidget".$this->m_iInputId.".OnSelectChange();\" value=\"-$iUniqueId\">";
|
||||||
foreach($this->m_aEditableFields as $sFieldCode)
|
foreach($this->m_aEditableFields as $sFieldCode)
|
||||||
@@ -185,12 +185,17 @@ class UILinksWidget
|
|||||||
}
|
}
|
||||||
$sState = '';
|
$sState = '';
|
||||||
|
|
||||||
$oP->add_script(
|
// Rows created with ajax call need OnLinkAdded call.
|
||||||
<<<EOF
|
// Rows added before loading the form cannot call OnLinkAdded.
|
||||||
|
if ($iUniqueId > 0)
|
||||||
|
{
|
||||||
|
$oP->add_script(
|
||||||
|
<<<EOF
|
||||||
PrepareWidgets();
|
PrepareWidgets();
|
||||||
oWidget{$this->m_iInputId}.OnLinkAdded($iUniqueId, $iRemoteObjKey);
|
oWidget{$this->m_iInputId}.OnLinkAdded($iUniqueId, $iRemoteObjKey);
|
||||||
EOF
|
EOF
|
||||||
);
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$bReadOnly)
|
if(!$bReadOnly)
|
||||||
|
|||||||
@@ -663,4 +663,34 @@ class ormLinkSet implements iDBObjectSetIterator, Iterator, SeekableIterator
|
|||||||
//
|
//
|
||||||
$oMtx->Unlock();
|
$oMtx->Unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function ToDBObjectSet($bShowObsolete = true)
|
||||||
|
{
|
||||||
|
$oAttDef = MetaModel::GetAttributeDef($this->sHostClass, $this->sAttCode);
|
||||||
|
$oLinkSearch = $this->GetFilter();
|
||||||
|
if ($oAttDef->IsIndirect())
|
||||||
|
{
|
||||||
|
$sExtKeyToRemote = $oAttDef->GetExtKeyToRemote();
|
||||||
|
$oLinkingAttDef = MetaModel::GetAttributeDef($this->sClass, $sExtKeyToRemote);
|
||||||
|
$sTargetClass = $oLinkingAttDef->GetTargetClass();
|
||||||
|
if (!$bShowObsolete && MetaModel::IsObsoletable($sTargetClass))
|
||||||
|
{
|
||||||
|
$oNotObsolete = new BinaryExpression(
|
||||||
|
new FieldExpression('obsolescence_flag', $sTargetClass),
|
||||||
|
'=',
|
||||||
|
new ScalarExpression(0)
|
||||||
|
);
|
||||||
|
$oNotObsoleteRemote = new DBObjectSearch($sTargetClass);
|
||||||
|
$oNotObsoleteRemote->AddConditionExpression($oNotObsolete);
|
||||||
|
$oLinkSearch->AddCondition_PointingTo($oNotObsoleteRemote, $sExtKeyToRemote);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$oLinkSet = new DBObjectSet($oLinkSearch);
|
||||||
|
$oLinkSet->SetShowObsoleteData($bShowObsolete);
|
||||||
|
if ($this->HasDelta())
|
||||||
|
{
|
||||||
|
$oLinkSet->AddObjectArray($this->aAdded);
|
||||||
|
}
|
||||||
|
return $oLinkSet;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -27,7 +27,7 @@ function LinksWidget(id, sClass, sAttCode, iInputId, sSuffix, bDuplicates, oWizH
|
|||||||
});
|
});
|
||||||
|
|
||||||
$('#linkedset_'+me.id+' :input').off('change').on('change', function() {
|
$('#linkedset_'+me.id+' :input').off('change').on('change', function() {
|
||||||
if (!($(this).hasClass('selection'))) {
|
if (!($(this).hasClass('selection')) && !($(this).hasClass('select_all'))) {
|
||||||
var oCheckbox = $(this).closest('tr').find('.selection');
|
var oCheckbox = $(this).closest('tr').find('.selection');
|
||||||
var iLink = oCheckbox.attr('data-link-id');
|
var iLink = oCheckbox.attr('data-link-id');
|
||||||
var iUniqueId = oCheckbox.attr('data-unique-id');
|
var iUniqueId = oCheckbox.attr('data-unique-id');
|
||||||
|
|||||||
Reference in New Issue
Block a user