Index: openacs-4/packages/contacts/tcl/contacts-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/tcl/contacts-procs.tcl,v diff -u -N -r1.71 -r1.72 --- openacs-4/packages/contacts/tcl/contacts-procs.tcl 13 Mar 2006 14:28:03 -0000 1.71 +++ openacs-4/packages/contacts/tcl/contacts-procs.tcl 15 Mar 2006 11:54:05 -0000 1.72 @@ -13,6 +13,7 @@ namespace eval contact::group:: {} namespace eval contact::revision:: {} namespace eval contact::rels:: {} +namespace eval contacts::person:: {} namespace eval contact::employee {} namespace eval contact::special_attributes {} @@ -926,6 +927,36 @@ } } +ad_proc -public contacts::person::new { + {-first_names:required} + {-last_name:required} + {-email:required} + {-contacts_package_id ""} +} { + Insert a new person into contacts + This will add them to the default group and add the ams attributes. +} { + + if {[string eq "" $contacts_package_id]} { + set contacts_package_id [ad_conn package_id] + } + + # Create the new person + set person_id [person::new -first_names $first_names -last_name $last_name -email $email] + + # Add to default group + set default_group_id [contacts::default_group -package_id $contacts_package_id] + + # Store the AMS attribute + set object_id [contact::revision::new -party_id $person_id] + ams::attribute::save::text -object_id $object_id -attribute_name "first_names" -value "$first_names" -object_type "person" + ams::attribute::save::text -object_id $object_id -attribute_name "last_name" -value "$last_name" -object_type "person" + ams::attribute::save::text -object_id $object_id -attribute_name "email" -value "$email" -object_type "person" + + return $person_id +} + + ad_proc -public contacts::get_values { {-attribute_name ""} {-group_name ""}