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 -r1.101 -r1.102 --- openacs-4/packages/contacts/tcl/contacts-procs.tcl 13 Dec 2006 13:03:53 -0000 1.101 +++ openacs-4/packages/contacts/tcl/contacts-procs.tcl 14 Dec 2006 07:57:11 -0000 1.102 @@ -132,6 +132,7 @@ lappend default_groups $default_group_id } + # Try to insert the persons into the package_id of the first group found db_foreach get_persons_without_items {} { foreach group_id $default_groups { if {[group::party_member_p -party_id $person_id -group_id $group_id]} { @@ -140,7 +141,15 @@ break } } + + # We did not found a group, so just use the first contacts instance. + ns_log notice "contacts::sweeper creating content_item and content_revision for party_id: $person_id" + contact::revision::new -party_id $person_id -package_id $contact_package_id + + # And insert into the default group for this package. + group::add_member -user_id $person_id -group_id $default_group_id } + db_foreach get_organizations_without_items {} { foreach group_id $default_groups { if {[group::party_member_p -party_id $organization_id -group_id $group_id]} { @@ -150,7 +159,7 @@ } } ns_log notice "contacts::sweeper creating content_item and content_revision for organization_id: $organization_id" - contact::revision::new -party_id $organization_id -package_id $package_id + contact::revision::new -party_id $organization_id -package_id $contact_package_id } if { ![info exists person_id] && ![info exists organization_id] } {