Index: openacs-4/packages/invoices/tcl/invoice-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/tcl/invoice-procs.tcl,v diff -u -r1.11 -r1.12 --- openacs-4/packages/invoices/tcl/invoice-procs.tcl 27 Dec 2005 18:26:10 -0000 1.11 +++ openacs-4/packages/invoices/tcl/invoice-procs.tcl 27 Dec 2005 20:17:40 -0000 1.12 @@ -190,8 +190,8 @@ # Get the invoice data db_1row get_data {} -column_array data - set locale [lang::user::site_wide_locale -user_id $recipient_id] - set contact_locale [lang::user::site_wide_locale -user_id $contact_id] + set locale [lang::user::site_wide_locale -user_id $data(recipient_id)] + set contact_locale [lang::user::site_wide_locale -user_id $data(contact_id)] set rec_locale $locale set data(creator_name) "$data(first_names) $data(last_name)" set data(amount_diff) [format "%.2f" [expr $data(total_amount) - $data(amount_sum)]] @@ -207,7 +207,7 @@ set data(creation_date) [lc_time_fmt $data(creation_date) $time_format] set data(due_date) [lc_time_fmt $data(due_date) $time_format] - set name [contact::name -party_id $recipient_id] + set name [contact::name -party_id $data(recipient_id)] set data(rep_first_names) [lindex $name 1] set data(rep_last_name) [string trim [lindex $name 0] ,] set data(recipient_name) "$data(rep_first_names) $data(rep_last_name)" @@ -216,30 +216,30 @@ set rec_orga_revision_id [content::item::get_best_revision -item_id $rec_organization_id] set contact_client_id [ams::value -attribute_name "client_id" -object_id $orga_revision_id -locale $contact_locale] set rec_client_id [ams::value -attribute_name "client_id" -object_id $rec_orga_revision_id -locale $rec_locale] - set rec_revision_id [content::item::get_best_revision -item_id $recipient_id] + set rec_revision_id [content::item::get_best_revision -item_id $data(recipient_id)] # invoice contact data - contact::employee::get -employee_id $contact_id -array contact_data + contact::employee::get -employee_id $data(contact_id) -array contact_data foreach attribute {name company_name_ext address town_line country country_code salutation salutation_letter} { set data(contact_$attribute) [value_if_exists contact_data($attribute)] } # invoice recipient data - if {[contact::organization_p -party_id $recipient_id]} { + if {[contact::organization_p -party_id $data(recipient_id)]} { # recipient is organization - set data(rec_name) [ams::value -object_id $recipient_id -attribute_name name] - set data(rec_company_name_ext) [ams::value -object_id $recipient_id -attribute_name company_name_ext] - set data(rec_salutation) [contact::salutation -party_id $recipient_id -type salutation] + set data(rec_name) [ams::value -object_id $data(recipient_id) -attribute_name name] + set data(rec_company_name_ext) [ams::value -object_id $data(recipient_id) -attribute_name company_name_ext] + set data(rec_salutation) [contact::salutation -party_id $data(recipient_id) -type salutation] set data(rec_salutation_letter) "" - contacts::postal_address::get -attribute_name "company_address" -party_id $recipient_id -array address_array + contacts::postal_address::get -attribute_name "company_address" -party_id $data(recipient_id) -array address_array set data(rec_address) [value_if_exists address_array(delivery_address)] set data(rec_country_code) [value_if_exists address_array(country_code)] set data(rec_country) [value_if_exists address_array(country)] set data(rec_town_line) [value_if_exists address_array(town_line)] } else { # recipient is person - contact::employee::get -employee_id $recipient_id -array recipient_data + contact::employee::get -employee_id $data(recipient_id) -array recipient_data foreach attribute {name company_name_ext address town_line country country_code salutation salutation_letter} { set data(rec_$attribute) [value_if_exists recipient_data($attribute)] } @@ -296,7 +296,7 @@ eval [template::adp_compile -string $styles] set styles_compiled $__adp_output - lappend final_content [contact::oo::change_content -path $template_path -document_filename "document.odt" -contents [list "content.xml" $content_compiled "styles.xml" $styles_compiled]] + lappend final_content [contact::oo::change_content -path "[acs_root_dir]/$template_path" -document_filename "document.odt" -contents [list "content.xml" $content_compiled "styles.xml" $styles_compiled]] } return $final_content