Index: trunk/kernel/include/searchitems.php =================================================================== diff -u -r1111 -r1124 --- trunk/kernel/include/searchitems.php (.../searchitems.php) (revision 1111) +++ trunk/kernel/include/searchitems.php (.../searchitems.php) (revision 1124) @@ -248,7 +248,14 @@ function AddSimpleCustomFields() { - $sql = "SELECT * FROM ".GetTablePrefix()."SearchConfig WHERE TableName='".$this->SourceTable."' AND SimpleSearch=1 AND CustomFieldId>0"; + $table_to_module = Array( 'Category' => 'In-Portal', + 'Link' => 'In-Link', + 'Topic' => 'In-Bulletin', + 'PortalUser' => 'In-Portal', + 'News' => 'In-News'); + $module = $table_to_module[$this->SourceTable]; + $sql = "SELECT * FROM ".GetTablePrefix()."SearchConfig WHERE ModuleName='".$module."' AND SimpleSearch=1 AND CustomFieldId>0"; + //$sql = "SELECT * FROM ".GetTablePrefix()."SearchConfig WHERE TableName='".$this->SourceTable."' AND SimpleSearch=1 AND CustomFieldId>0"; //echo $sql; foreach($this->Relationships as $Table=>$clause) { @@ -512,7 +519,7 @@ if(is_array($idlist)) { - $SelectSQL .= " AND (ResourceId IN (".implode(",",$idlist)."))"; + $SelectSQL .= " AND (".$this->SourceTable.".ResourceId IN (".implode(",",$idlist)."))"; } } $SelectSQL .= " GROUP BY $idField ";