\n";
- $oFilter = new DBObjectSearch($this->m_sRemoteClass);
+
+ $oAlreadyLinkedFilter = new DBObjectSearch($this->m_sRemoteClass);
if (!$this->m_bDuplicatesAllowed && count($aAlreadyLinkedIds) > 0)
{
- $oFilter->AddCondition('id', $aAlreadyLinkedIds, 'NOTIN');
+ $oAlreadyLinkedFilter->AddCondition('id', $aAlreadyLinkedIds, 'NOTIN');
+ $oAlreadyLinkedExpression = $oAlreadyLinkedFilter->GetCriteria();
+ $sAlreadyLinkedExpression = $oAlreadyLinkedExpression->Render();
}
+ else
+ {
+ $sAlreadyLinkedExpression = '';
+ }
+
+ $oFilter = new DBObjectSearch($this->m_sRemoteClass);
if ($oCurrentObj != null)
{
$this->SetSearchDefaultFromContext($oCurrentObj, $oFilter);
@@ -418,6 +427,7 @@ EOF
'json' => $sJson,
'cssCount' => '#count_'.$this->m_sAttCode.$this->m_sNameSuffix,
'query_params' => $oFilter->GetInternalParams(),
+ 'hidden_criteria' => $sAlreadyLinkedExpression,
));
$sHtml .= "