Index: openacs-4/packages/contacts/www/group-party-add.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/www/group-party-add.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/contacts/www/group-party-add.tcl 15 Feb 2006 10:06:36 -0000 1.6 +++ openacs-4/packages/contacts/www/group-party-add.tcl 20 Feb 2006 10:36:33 -0000 1.7 @@ -10,12 +10,11 @@ {return_url ""} } - set party_id [lindex $party_id 0] contact::require_visiblity -party_id $party_id set object_type [contact::type -party_id $party_id] switch $object_type { - person { + person - user { set rel_type "membership_rel" } organization { @@ -25,7 +24,6 @@ set rel_type "membership_rel" } } - ns_log notice "\#\#\# rel_type $rel_type" if {$rel_type == "organization_rel"} { set user_id [ad_conn user_id] @@ -38,12 +36,19 @@ callback contact::organization_new_group -organization_id $party_id -group_id $group_id } else { - group::add_member \ - -group_id $group_id \ - -user_id $party_id \ - -rel_type membership_rel + set rel_id [relation::get_id -object_id_one $group_id -object_id_two $party_id -rel_type "membership_rel"] + if { [exists_and_not_null rel_id] } { + # this relationship was previously deleted and needs to be approved + db_dml update_state {} + } else { + group::add_member \ + -group_id $group_id \ + -user_id $party_id \ + -rel_type membership_rel + } } + if { ![exists_and_not_null return_url] } { set return_url[contact::url -party_id $party_id] } Index: openacs-4/packages/contacts/www/group-party-add.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/www/group-party-add.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/contacts/www/group-party-add.xql 30 Aug 2005 09:37:33 -0000 1.1 +++ openacs-4/packages/contacts/www/group-party-add.xql 20 Feb 2006 10:36:33 -0000 1.2 @@ -7,4 +7,10 @@ + + + update membership_rels set member_state = 'approved' where rel_id = :rel_id + + +