Index: openacs-4/packages/contacts/tcl/contact-employee-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/tcl/contact-employee-procs.tcl,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/contacts/tcl/contact-employee-procs.tcl 12 Jun 2006 07:55:36 -0000 1.3 +++ openacs-4/packages/contacts/tcl/contact-employee-procs.tcl 8 Sep 2006 13:45:33 -0000 1.4 @@ -408,6 +408,12 @@ if { $package_id eq "" } { set package_id [ad_conn package_id] } + + # Make sure the package_id belongs to a contacts package + if { ![string eq [apm_package_key_from_id $package_id] "contacts"]} { + set package_id [acs_object::package_id -object_id [content::item::get_best_revision -item_id $employee_id]] + } + return [util_memoize [list ::contact::util::get_employee_organization_not_cached -employee_id $employee_id -package_id $package_id]] } 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.94 -r1.95 --- openacs-4/packages/contacts/tcl/contacts-procs.tcl 26 Jun 2006 21:55:16 -0000 1.94 +++ openacs-4/packages/contacts/tcl/contacts-procs.tcl 8 Sep 2006 13:45:33 -0000 1.95 @@ -101,7 +101,7 @@ contact::revision::new -party_id $organization_id } if { ![info exists person_id] && ![info exists organization_id] } { - ns_log notice "contacts::sweeper no person or organization objects exist that do not have associated content_items" + ns_log Debug "contacts::create_revisions_sweeper no person or organization objects exist that do not have associated content_items" } db_dml insert_privacy_records {} } @@ -618,13 +618,20 @@ ad_proc -public contact::revision::new { {-party_id:required} {-party_revision_id ""} + {-package_id ""} } { create a contact revision } { + if {$package_id eq ""} { + set package_id [ad_conn package_id] + } + set extra_vars [ns_set create] oacs_util::vars_to_ns_set -ns_set $extra_vars -var_list {party_id party_revision_id} - return [package_instantiate_object \ + set party_revision_id [package_instantiate_object \ -extra_vars $extra_vars contact_party_revision] + db_dml update_package_id "update acs_objects set package_id = :package_id where object_id = :party_revision_id" + return $party_revision_id } ad_proc -public contact::live_revision { @@ -718,7 +725,7 @@ # Make sure that we do not upgrade an already existing user - if {![contact::user_p -party_id $person_id]} { + if {![contact::user_p -party_id $person_id] && [string eq "" [acs_user::get_by_username -username $username]]} { db_transaction { db_dml upgrade_user {update acs_objects set object_type = 'user' where object_id = :user_id;