Index: openacs-4/packages/contacts/lib/letter.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/lib/letter.tcl,v diff -u -r1.10 -r1.11 --- openacs-4/packages/contacts/lib/letter.tcl 22 Feb 2006 01:40:39 -0000 1.10 +++ openacs-4/packages/contacts/lib/letter.tcl 5 Mar 2006 08:34:12 -0000 1.11 @@ -144,13 +144,23 @@ set total_count [llength $party_ids] foreach party_id $party_ids { - set name [contact::name -party_id $party_id] - set first_names [lindex $name 0] - set last_name [lindex $name 1] - set locale [lang::user::site_wide_locale -user_id $party_id] - set revision_id [contact::live_revision -party_id $party_id] - set salutation [ams::value -attribute_name "salutation" -object_id $revision_id -locale $locale] + # Differentiate between person and organization + if {[person::person_p -party_id $party_id]} { + contact::employee::get -employee_id $party_id -array employee + set first_names $employee(first_names) + set last_name $employee(last_name) + set name [string trim "$employee(person_title) $first_names $last_name"] + set salutation $employee(salutation) + set directphone $employee(directphoneno) + set mailing_address $employee(mailing_address) + set locale $employee(locale) + } else { + set name [contact::name -party_id $party_id] + set salutation "Dear ladies and gentlemen" + set locale [lang::user::site_wide_locale -user_id $party_id] + } + set letter "" if { [exists_and_not_null date] } { # do not pull the date variable out here and reformat @@ -160,12 +170,13 @@ append letter "\n
[lc_time_fmt $date %q $locale]
" } if { $include_address eq "1" } { - set mailing_address [contact::message::mailing_address -party_id $party_id -format "text/html"] - append letter "\n
$name
$mailing_address
" + # this work differnt from the contact::employee::get mailing address because that is + # in text format, but we need it as html + append letter "\n
$name
[contact::message::mailing_address -party_id $party_id -format "text/html"]
" } append letter "\n
${content_html}
" set values [list] - foreach element [list first_names last_name name mailing_address date salutation] { + foreach element [list first_names last_name name date salutation mailing_address directphone] { lappend values [list "{$element}" [set $element]] } set letter [contact::message::interpolate -text $letter -values $values]