mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-18 14:58:43 +02:00
Make sure that we attach ONLY the elements that are visible in the form when using the "select all" mode for managing 1:n links.
SVN:trunk[2984]
This commit is contained in:
@@ -232,7 +232,8 @@ $(function()
|
||||
iKey = parseInt(this.value, 10); // Numbers are in base 10
|
||||
oParams.aAlreadyLinked.push(iKey);
|
||||
}
|
||||
); oParams.operation = 'searchObjectsToAdd2';
|
||||
);
|
||||
oParams.operation = 'searchObjectsToAdd2';
|
||||
oParams['class'] = this.options.class_name;
|
||||
oParams.real_class = '';
|
||||
oParams.att_code = this.options.att_code;
|
||||
@@ -325,11 +326,18 @@ $(function()
|
||||
_onDoAdd:function()
|
||||
{
|
||||
var oParams = this._getSelection('selectObject');
|
||||
this.oDlg.dialog('close');
|
||||
oParams.operation = 'doAddObjects2';
|
||||
oParams['class'] = this.options.class_name;
|
||||
oParams.att_code = this.options.att_code;
|
||||
oParams.iInputId = this.id;
|
||||
|
||||
// Retrieve the 'filter' definition, BEFORE closing the dialog and destroying its contents
|
||||
var table = $('#ResultsToAdd_'+this.id).find('table.listResults')[0];
|
||||
oParams.filter = table.config.filter;
|
||||
oParams.extra_params = table.config.extra_params;
|
||||
|
||||
this.oDlg.dialog('close');
|
||||
|
||||
var me = this;
|
||||
$.post(this.options.submit_to, oParams, function(data) {
|
||||
var oInserted = $(data);
|
||||
|
||||
@@ -336,14 +336,27 @@ try
|
||||
$sAttCode = utils::ReadParam('att_code', '');
|
||||
$iInputId = utils::ReadParam('iInputId', '');
|
||||
$iCurrObjectId = utils::ReadParam('iObjId', 0);
|
||||
$sFilter = utils::ReadParam('filter', '');
|
||||
$sFilter = utils::ReadParam('filter', '', false, 'raw_data');
|
||||
if ($sFilter != '')
|
||||
{
|
||||
$oFullSetFilter = DBObjectSearch::unserialize($sFilter);
|
||||
}
|
||||
else
|
||||
{
|
||||
$oFullSetFilter = new DBObjectSearch($sRemoteClass);
|
||||
$oLinksetDef = MetaModel::GetAttributeDef($sClass, $sAttCode);
|
||||
$valuesDef = $oLinksetDef->GetValuesDef();
|
||||
if ($valuesDef === null)
|
||||
{
|
||||
$oFullSetFilter = new DBObjectSearch($oLinksetDef->GetLinkedClass());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!$valuesDef instanceof ValueSetObjects)
|
||||
{
|
||||
throw new Exception('Error: only ValueSetObjects are supported for "allowed_values" in AttributeLinkedSet ('.$this->sClass.'/'.$this->sAttCode.').');
|
||||
}
|
||||
$oFullSetFilter = DBObjectSearch::FromOQL($valuesDef->GetFilterExpression());
|
||||
}
|
||||
}
|
||||
$oWidget = new UILinksWidgetDirect($sClass, $sAttCode, $iInputId);
|
||||
$oWidget->DoAddObjects($oPage, $oFullSetFilter);
|
||||
|
||||
Reference in New Issue
Block a user