Index: openacs-4/packages/contacts/tcl/contact-search-condition-type-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/tcl/contact-search-condition-type-procs.tcl,v diff -u -r1.26 -r1.27 --- openacs-4/packages/contacts/tcl/contact-search-condition-type-procs.tcl 8 May 2006 22:48:06 -0000 1.26 +++ openacs-4/packages/contacts/tcl/contact-search-condition-type-procs.tcl 12 May 2006 21:10:45 -0000 1.27 @@ -249,12 +249,27 @@ set form_elements [list] if { !$only_multiple_p } { - set attribute_options [db_list_of_lists get_attributes { - select pretty_name, attribute_id - from ams_attributes - where object_type in ('organization','party','person','user') - and ams_attribute_id is not null - }] + if { $object_type eq "" } { set object_type "party" } + set list_ids [contact::util::get_ams_list_ids -privilege "read" -object_type $object_type] + if { [llength $list_ids] == 0 } { + return {} + } + if { $object_type ne "party" } { + set object_type_clause "and object_type in ('party','${object_type}')" + } else { + set object_type_clause "" + } + + set attribute_options [db_list_of_lists get_all_attributes " + select pretty_name, attribute_id + from ams_attributes + where attribute_id in ( select attribute_id + from ams_list_attribute_map + where list_id in ([template::util::tcl_to_sql_list $list_ids]) + ) + $object_type_clause + and not deprecated_p + "] } else { set attribute_options [contacts::attribute::options_attribute] }