Index: openacs-4/packages/contacts/lib/contact-relationships-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/lib/contact-relationships-postgresql.xql,v diff -u -r1.7 -r1.8 --- openacs-4/packages/contacts/lib/contact-relationships-postgresql.xql 28 Apr 2006 10:15:08 -0000 1.7 +++ openacs-4/packages/contacts/lib/contact-relationships-postgresql.xql 3 May 2006 21:28:06 -0000 1.8 @@ -16,8 +16,10 @@ and acs_objects.object_id = acs_rels.rel_id and ( object_id_one = :party_id or object_id_two = :party_id ) and acs_rels.rel_type in ( select object_type from acs_object_types where supertype = 'contact_rel') - ) rels_temp, acs_objects + ) rels_temp, acs_objects, group_distinct_member_map where rels_temp.rel_id = acs_objects.object_id + and rels_temp.other_party_id = group_distinct_member_map.member_id + and group_distinct_member_map.group_id in ([template::util::tcl_to_sql_list [contacts::default_groups]]) order by upper(role_singular) asc, $sort_order Index: openacs-4/packages/contacts/lib/contact-relationships.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/lib/contact-relationships.tcl,v diff -u -r1.10 -r1.11 --- openacs-4/packages/contacts/lib/contact-relationships.tcl 28 Apr 2006 10:15:08 -0000 1.10 +++ openacs-4/packages/contacts/lib/contact-relationships.tcl 3 May 2006 21:28:06 -0000 1.11 @@ -39,32 +39,30 @@ lappend groups_belonging_to [contacts::default_group] db_foreach get_relationships {} { - if { [contact::visible_p -party_id $other_party_id] } { - set contact_url [contact::url -party_id $other_party_id] - if {[organization::organization_p -party_id $other_party_id]} { - set other_object_type "organization" - } else { - set other_object_type "person" - } - if {[string eq $rel_type "contact_rels_employment"]} { - set relation_url [export_vars -base "[ad_conn package_url]add/$other_object_type" -url {{group_ids $groups_belonging_to} {object_id_two "$party_id"} rel_type}] - } else { - set relation_url "" - } + set contact_url [contact::url -party_id $other_party_id] + if {[organization::organization_p -party_id $other_party_id]} { + set other_object_type "organization" + } else { + set other_object_type "person" + } + if {[string eq $rel_type "contact_rels_employment"]} { + set relation_url [export_vars -base "[ad_conn package_url]add/$other_object_type" -url {{group_ids $groups_belonging_to} {object_id_two "$party_id"} rel_type}] + } else { + set relation_url "" + } - set creation_date [lc_time_fmt $creation_date %q] - set role_singular [lang::util::localize $role_singular] - multirow append rels $role_singular $relation_url $other_name $contact_url {} {} $creation_date + set creation_date [lc_time_fmt $creation_date %q] + set role_singular [lang::util::localize $role_singular] + multirow append rels $role_singular $relation_url $other_name $contact_url {} {} $creation_date + + # NOT YET IMPLEMENTED - Checking to see if role_singular or role_plural is needed - # NOT YET IMPLEMENTED - Checking to see if role_singular or role_plural is needed - - if { [ams::list::exists_p -package_key "contacts" -object_type ${rel_type} -list_name ${package_id}] } { - set details_list [ams::values -package_key "contacts" -object_type $rel_type -list_name $package_id -object_id $rel_id -format "text"] - - if { [llength $details_list] > 0 } { - foreach {section attribute_name pretty_name value} $details_list { - multirow append rels $role_singular $relation_url $other_name $contact_url $pretty_name $value $creation_date - } + if { [ams::list::exists_p -package_key "contacts" -object_type ${rel_type} -list_name ${package_id}] } { + set details_list [ams::values -package_key "contacts" -object_type $rel_type -list_name $package_id -object_id $rel_id -format "text"] + + if { [llength $details_list] > 0 } { + foreach {section attribute_name pretty_name value} $details_list { + multirow append rels $role_singular $relation_url $other_name $contact_url $pretty_name $value $creation_date } } } Index: openacs-4/packages/contacts/www/contact-rels-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/www/contact-rels-postgresql.xql,v diff -u -r1.7 -r1.8 --- openacs-4/packages/contacts/www/contact-rels-postgresql.xql 24 Mar 2006 13:15:28 -0000 1.7 +++ openacs-4/packages/contacts/www/contact-rels-postgresql.xql 3 May 2006 21:28:06 -0000 1.8 @@ -37,7 +37,9 @@ where acs_rels.rel_type = acs_rel_types.rel_type and ( object_id_one = :party_id or object_id_two = :party_id ) and acs_rels.rel_type in ( select object_type from acs_object_types where supertype = 'contact_rel') -) rels_temp +) rels_temp, group_distinct_member_map + where rels_temp.other_party_id = group_distinct_member_map.member_id + and group_distinct_member_map.group_id in ([template::util::tcl_to_sql_list [contacts::default_groups]]) [template::list::orderby_clause -orderby -name "relationships"] @@ -54,7 +56,7 @@ ( select name from organizations where organization_id = party_id ) as organization from parties left join cr_items on (parties.party_id = cr_items.item_id) left join cr_revisions on (cr_items.latest_revision = cr_revisions.revision_id ) , group_distinct_member_map where parties.party_id = group_distinct_member_map.member_id - and group_distinct_member_map.group_id in ('[join [contacts::default_groups] "','"]') + and group_distinct_member_map.group_id in ([template::util::tcl_to_sql_list [contacts::default_groups]]) $type_clause [contact::search_clause -and -search_id $search_id -query $query -party_id "parties.party_id" -revision_id "revision_id"] order by upper(contact__name(parties.party_id))