Index: trunk/kernel/include/searchitems.php =================================================================== diff -u -r1155 -r1157 --- trunk/kernel/include/searchitems.php (.../searchitems.php) (revision 1155) +++ trunk/kernel/include/searchitems.php (.../searchitems.php) (revision 1157) @@ -754,14 +754,22 @@ //$return .= $notallowed; if (strlen($notallowed) && is_object($SearchObj)) { - $or_is_null = ' OR '.substr($notallowed, 0, strpos($notallowed, 'NOT')).' IS NULL '; + $elements = explode('.', $notallowed); // this and below code is to detect if $notallowed clause is concerned custom field or not + if (strpos($elements[0], 'inp')) + { + $or_is_null = ''; + } + else + { + $or_is_null = ' OR '.substr($notallowed, 1, strpos($notallowed, 'NOT') - 1).' IS NULL '; + } if (!strlen($SearchObj->ExcludeWhereClause)) { - $SearchObj->ExcludeWhereClause = '('.$notallowed.$or_is_null.'))'; + $SearchObj->ExcludeWhereClause = '('.$notallowed.$or_is_null.')'; } else { - $SearchObj->ExcludeWhereClause .= ' AND ('.$notallowed.$or_is_null.'))'; + $SearchObj->ExcludeWhereClause .= ' AND ('.$notallowed.$or_is_null.')'; } }