N°895 Portal: Filter linkedsets on remote object scopes

This commit is contained in:
Molkobain
2019-08-13 16:59:25 +02:00
parent 0985415e11
commit 384641e274
3 changed files with 78 additions and 4 deletions

View File

@@ -19,14 +19,14 @@
namespace Combodo\iTop\Renderer\Bootstrap\FieldRenderer;
use Exception;
use ApplicationContext;
use IssueLog;
use Dict;
use MetaModel;
use AttributeFriendlyName;
use Combodo\iTop\Renderer\FieldRenderer;
use Combodo\iTop\Renderer\RenderingOutput;
use Dict;
use Exception;
use IssueLog;
use MetaModel;
/**
* Description of BsLinkedSetFieldRenderer
@@ -540,6 +540,7 @@ JS
*/
protected function PrepareItems(&$aItems, &$aItemIds)
{
/** @var \ormLinkSet $oValueSet */
$oValueSet = $this->oField->GetCurrentValue();
$oValueSet->OptimizeColumnLoad(array($this->oField->GetTargetClass() => $this->oField->GetAttributesToDisplay(true)));
while ($oItem = $oValueSet->Fetch())
@@ -564,6 +565,12 @@ JS
$oRemoteItem = $oItem;
}
// Skip item if not supposed to be displayed
if ($this->oField->IsLimitedAccessItem($oRemoteItem->GetKey()))
{
continue;
}
$aItemProperties = array(
'id' => ($this->oField->IsIndirect() && $oItem->IsNew()) ? -1*$oRemoteItem->GetKey() : $oItem->GetKey(),
'target_id' => $oRemoteItem->GetKey(),
@@ -615,6 +622,7 @@ JS
$aItems[] = $aItemProperties;
$aItemIds[$aItemProperties['id']] = array();
}
$oValueSet->rewind();
}
}