Index: openacs-4/packages/invoices/lib/invoice-list.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/lib/invoice-list.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/invoices/lib/invoice-list.tcl 11 Oct 2005 16:15:00 -0000 1.5 +++ openacs-4/packages/invoices/lib/invoice-list.tcl 27 Oct 2005 19:30:16 -0000 1.6 @@ -70,6 +70,10 @@ label {[_ invoices.iv_invoice_paid_amount]} display_template {@iv_invoice.paid_amount@ @iv_invoice.paid_currency@} } + recipient { + label "[_ invoices.iv_invoice_recipient]" + display_template "@iv_invoice.recipient;noquote@" + } creation_user { label {[_ invoices.iv_invoice_creation_user]} display_template {@iv_invoice.first_names@ @iv_invoice.last_name@} @@ -157,7 +161,9 @@ } } -db_multirow -extend {creator_link edit_link cancel_link delete_link checkbox} iv_invoice iv_invoice {} { +set contacts_p [apm_package_installed_p contacts] + +db_multirow -extend {creator_link edit_link cancel_link delete_link checkbox recipient} iv_invoice iv_invoice {} { # Ugly hack. We should find out which contact package is linked set creator_link "/contacts/$creation_user" set edit_link [export_vars -base "${base_url}invoice-ae" {invoice_id}] @@ -175,4 +181,9 @@ } else { set checkbox "" } + if { $contacts_p } { + set recipient "[contact::name -party_id $recipient_id]" + } else { + set recipient [person::name -person_id $recipient_id] + } } Index: openacs-4/packages/invoices/lib/invoice-list.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/lib/invoice-list.xql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/invoices/lib/invoice-list.xql 11 Oct 2005 15:23:28 -0000 1.3 +++ openacs-4/packages/invoices/lib/invoice-list.xql 27 Oct 2005 19:30:16 -0000 1.4 @@ -9,7 +9,7 @@ t.paid_currency, p.first_names, p.last_name, o.creation_user, to_char(o.creation_date, :timestamp_format) as creation_date, to_char(t.due_date, :date_format) as due_date, t.parent_invoice_id, - t.invoice_id as invoice_rev_id, t.cancelled_p, t.status + t.invoice_id as invoice_rev_id, t.cancelled_p, t.status, t.recipient_id from cr_folders cf, cr_items ci, cr_revisions cr, iv_invoices t, acs_objects o, persons p where cr.revision_id = ci.latest_revision Index: openacs-4/packages/invoices/lib/projects-billable.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/lib/projects-billable.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/invoices/lib/projects-billable.tcl 26 Oct 2005 06:39:27 -0000 1.5 +++ openacs-4/packages/invoices/lib/projects-billable.tcl 27 Oct 2005 19:33:52 -0000 1.6 @@ -54,7 +54,10 @@ set p_closed_id [pm::project::default_status_closed] set t_closed_id [pm::task::default_status_closed] set currency [iv::price_list::get_currency -organization_id $organization_id] -set contacts_url [apm_package_url_from_key contacts] +set contacts_p [apm_package_installed_p contacts] +if { $contacts_p } { + set contacts_url [apm_package_url_from_key contacts] +} if {$no_actions_p} { set actions "" @@ -82,6 +85,10 @@ label {[_ invoices.iv_invoice_project_title]} display_template {@projects.title@} } + recipient { + label "[_ invoices.iv_invoice_recipient]" + display_template {@projects.recipient;noquote@ } + } description { label {[_ invoices.iv_invoice_project_descr]} } @@ -164,8 +171,15 @@ } -db_multirow -extend {project_link} projects projects_to_bill {} { + +db_multirow -extend {project_link recipient} projects projects_to_bill {} { set project_link [export_vars -base "${pm_base_url}one" {{project_item_id $project_id}}] set amount_open [format "%.2f" $amount_open] set creation_date [lc_time_fmt $creation_date "%q %X"] + + if { $contacts_p } { + set recipient "[contact::name -party_id $recipient_id]" + } else { + set recipient [person::name -person_id $recipient_id] + } } Index: openacs-4/packages/invoices/lib/projects-billable.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/lib/projects-billable.xql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/invoices/lib/projects-billable.xql 26 Oct 2005 06:37:57 -0000 1.3 +++ openacs-4/packages/invoices/lib/projects-billable.xql 27 Oct 2005 19:30:16 -0000 1.4 @@ -5,7 +5,7 @@ select r.item_id as project_id, r.title, r.description, sub.amount_open, - sub.creation_date, total.count_total, billed.count_billed, name + sub.creation_date, total.count_total, billed.count_billed, name, billed.recipient_id from ( select oi.item_id as offer_id, pr.revision_id, o.creation_date, sum(ofi.item_units * ofi.price_per_unit * (1-(ofi.rebate/100))) as amount_open, @@ -36,15 +36,15 @@ where ofi.offer_id = oi.latest_revision group by oi.item_id ) total, ( - select count(i.invoice_id) as count_billed, oi.item_id + select count(i.invoice_id) as count_billed, oi.item_id, i.recipient_id from cr_items oi, iv_offer_items ofi left outer join iv_invoice_items ii on (ii.offer_item_id = ofi.offer_item_id) left outer join iv_invoices i on (ii.invoice_id = i.invoice_id and i.cancelled_p = 'f') where ofi.offer_id = oi.latest_revision - group by oi.item_id + group by oi.item_id, i.recipient_id ) billed, cr_revisions r where r.revision_id = sub.revision_id and total.item_id = sub.offer_id Index: openacs-4/packages/invoices/www/invoice-list.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/invoice-list.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/invoices/www/invoice-list.tcl 11 Oct 2005 16:15:01 -0000 1.2 +++ openacs-4/packages/invoices/www/invoice-list.tcl 27 Oct 2005 19:35:09 -0000 1.3 @@ -17,6 +17,6 @@ set page_title "[_ invoices.iv_invoice_2]" set context [list $page_title] -set row_list {checkbox {} invoice_nr {} title {} description {} total_amount {} creation_user {} creation_date {} due_date {} action {}} +set row_list {checkbox {} invoice_nr {} title {} description {} recipient {} total_amount {} creation_user {} creation_date {} due_date {} action {}} ad_return_template Index: openacs-4/packages/invoices/www/projects-billable.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/projects-billable.adp,v diff -u -r1.5 -r1.6 --- openacs-4/packages/invoices/www/projects-billable.adp 26 Oct 2005 14:31:05 -0000 1.5 +++ openacs-4/packages/invoices/www/projects-billable.adp 27 Oct 2005 19:35:09 -0000 1.6 @@ -6,7 +6,7 @@ @iv_invoice.paid_amount@ @iv_invoice.paid_currency@} } + recipient { + label "[_ invoices.iv_invoice_recipient]" + display_template "@iv_invoice.recipient;noquote@" + } creation_user { label {[_ invoices.iv_invoice_creation_user]} display_template {@iv_invoice.first_names@ @iv_invoice.last_name@} @@ -92,7 +96,9 @@ } -db_multirow -extend {creator_link edit_link cancel_link delete_link} iv_invoice iv_invoice {} { +set contacts_p [apm_package_installed_p contacts] + +db_multirow -extend {creator_link edit_link cancel_link delete_link recipient} iv_invoice iv_invoice {} { # Ugly hack. We should find out which contact package is linked set creator_link "/contacts/$creation_user" set edit_link [export_vars -base "${base_url}/invoice-ae" {invoice_id}] @@ -105,4 +111,9 @@ if {![empty_string_p $paid_amount]} { set paid_amount [format "%.2f" $paid_amount] } + if { $contacts_p } { + set recipient "[contact::name -party_id $recipient_id]" + } else { + set recipient [person::name -person_id $recipient_id] + } } Index: openacs-4/packages/invoices-portlet/lib/invoice-list.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices-portlet/lib/invoice-list.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/invoices-portlet/lib/invoice-list.xql 26 Oct 2005 22:45:10 -0000 1.2 +++ openacs-4/packages/invoices-portlet/lib/invoice-list.xql 27 Oct 2005 19:35:38 -0000 1.3 @@ -12,6 +12,7 @@ t.currency, t.paid_amount, t.paid_currency, + t.recipient_id, p.first_names, p.last_name, o.creation_user, Index: openacs-4/packages/invoices-portlet/lib/projects-billable.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices-portlet/lib/projects-billable.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/invoices-portlet/lib/projects-billable.tcl 24 Oct 2005 20:45:37 -0000 1.3 +++ openacs-4/packages/invoices-portlet/lib/projects-billable.tcl 27 Oct 2005 19:35:38 -0000 1.4 @@ -52,8 +52,12 @@ set date_format [lc_get formbuilder_date_format] set timestamp_format "$date_format [lc_get formbuilder_time_format]" set currency [iv::price_list::get_currency -organization_id $organization_id] -set contacts_url [apm_package_url_from_key contacts] +set contacts_p [apm_package_installed_p contacts] +if { $contacts_p } { + set contacts_url [apm_package_url_from_key contacts] +} + set actions [list "[_ invoices.iv_invoice_New]" "${base_url}invoice-ae" "[_ invoices.iv_invoice_New2]" ] template::list::create \ @@ -77,6 +81,10 @@ description { label {[_ invoices.iv_invoice_project_descr]} } + recipient { + label {[_ invoices.iv_invoice_recipient]} + display_template "@projects.recipient;noquote@" + } amount_open { label {[_ invoices.iv_invoice_amount_open]} display_template {@projects.amount_open@ @currency@} @@ -113,7 +121,14 @@ } -db_multirow -extend {project_link} projects projects_to_bill {} { + +db_multirow -extend {project_link recipient} projects projects_to_bill {} { set project_link [export_vars -base "${pm_base_url}one" {{project_item_id $project_id}}] set amount_open [format "%.2f" $amount_open] + + if { $contacts_p } { + set recipient "[contact::name -party_id $recipient_id]" + } else { + set recipient [person::name -person_id $recipient_id] + } } Index: openacs-4/packages/invoices-portlet/lib/projects-billable.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices-portlet/lib/projects-billable.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/invoices-portlet/lib/projects-billable.xql 26 Oct 2005 22:45:10 -0000 1.2 +++ openacs-4/packages/invoices-portlet/lib/projects-billable.xql 27 Oct 2005 19:35:38 -0000 1.3 @@ -11,6 +11,7 @@ to_char(sub.creation_date, :timestamp_format) as creation_date, total.count_total, billed.count_billed, + billed.recipient_id, name from ( @@ -75,7 +76,8 @@ ( select count(i.invoice_id) as count_billed, - oi.item_id + oi.item_id, + i.recipient_id from cr_items oi, iv_offer_items ofi @@ -84,7 +86,7 @@ where ofi.offer_id = oi.latest_revision group by - oi.item_id + oi.item_id, i.recipient_id ) billed, cr_revisions r where Index: openacs-4/packages/invoices-portlet/www/invoices-list-portlet.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices-portlet/www/invoices-list-portlet.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/invoices-portlet/www/invoices-list-portlet.tcl 16 Aug 2005 20:14:55 -0000 1.1 +++ openacs-4/packages/invoices-portlet/www/invoices-list-portlet.tcl 27 Oct 2005 19:35:38 -0000 1.2 @@ -1,5 +1,5 @@ -set row_list {invoice_nr {} title {} description {} total_amount {} paid_amount {} creation_user {} creation_date {} due_date {} action {}} +set row_list {invoice_nr {} title {} description {} total_amount {} paid_amount {} recipient {} creation_user {} creation_date {} due_date {} action {}} set organization_id [lindex \ [application_data_link::get_linked \ Index: openacs-4/packages/invoices-portlet/www/invoices-portlet.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices-portlet/www/invoices-portlet.adp,v diff -u -r1.3 -r1.4 --- openacs-4/packages/invoices-portlet/www/invoices-portlet.adp 9 Oct 2005 13:54:41 -0000 1.3 +++ openacs-4/packages/invoices-portlet/www/invoices-portlet.adp 27 Oct 2005 19:35:38 -0000 1.4 @@ -1,2 +1 @@ - - + Index: openacs-4/packages/invoices-portlet/www/invoices-portlet.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices-portlet/www/invoices-portlet.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/invoices-portlet/www/invoices-portlet.tcl 9 Oct 2005 13:54:41 -0000 1.2 +++ openacs-4/packages/invoices-portlet/www/invoices-portlet.tcl 27 Oct 2005 19:35:38 -0000 1.3 @@ -1,6 +1,6 @@ # packages/invoices-portlet/www/invoices-portlet.tcl -set row_list { title {} description {} creation_date {} amount_open {} count_total {} count_billed {} } +set elements_list [list title description recipient creation_date amount_open count_total count_billed] set community_id [dotlrn_community::get_community_id_from_url] # set base_url "[dotlrn_community::get_community_url $community_id]"