Index: openacs-4/packages/invoices/catalog/invoices.de_DE.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/catalog/invoices.de_DE.ISO-8859-1.xml,v diff -u -r1.7 -r1.8 --- openacs-4/packages/invoices/catalog/invoices.de_DE.ISO-8859-1.xml 12 Oct 2005 13:25:34 -0000 1.7 +++ openacs-4/packages/invoices/catalog/invoices.de_DE.ISO-8859-1.xml 14 Oct 2005 06:25:02 -0000 1.8 @@ -217,6 +217,7 @@ Zahlungsziel (Tage) Wie viele Tage hat der Kunde, bis die Rechnung gezahlt werden muss Projekt + Ansprechpartner Beschreibung Projektname Projekt Nummer Index: openacs-4/packages/invoices/catalog/invoices.en_US.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/catalog/invoices.en_US.ISO-8859-1.xml,v diff -u -r1.7 -r1.8 --- openacs-4/packages/invoices/catalog/invoices.en_US.ISO-8859-1.xml 12 Oct 2005 13:25:34 -0000 1.7 +++ openacs-4/packages/invoices/catalog/invoices.en_US.ISO-8859-1.xml 14 Oct 2005 06:25:02 -0000 1.8 @@ -76,7 +76,7 @@ Cancellation Add invoice cancellation <html><body><h3>Cancellation</h3>%invoice_text%</html></body> - Cancellation # %invoice_nr% + Cancellation # %invoice_nr% Finished on Billed items Total items @@ -221,6 +221,7 @@ Payment after .. days How many days has the customer until the invoice has to be paid Project + Contact Description Project Name Project ID Index: openacs-4/packages/invoices/lib/offer-list.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/lib/offer-list.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/invoices/lib/offer-list.tcl 11 Oct 2005 15:23:28 -0000 1.5 +++ openacs-4/packages/invoices/lib/offer-list.tcl 14 Oct 2005 06:25:03 -0000 1.6 @@ -21,7 +21,8 @@ } } } -set status_id 2 +# set status_id 2 +# db_1row get_offer_status_id {} if {![info exists status_id]} { db_1row get_offer_status_id {} } @@ -93,6 +94,10 @@ label {[_ invoices.iv_offer_project]} display_template {@iv_offer.project_title@} } + project_contact { + label {[_ invoices.iv_offer_project_contact]} + display_template {@iv_offer.contact_first_names@ @iv_offer.contact_last_name@} + } amount_total { label {[_ invoices.iv_offer_amount_total]} display_template {@iv_offer.amount_total@ @iv_offer.currency@} @@ -141,6 +146,12 @@ orderby {lower(pr.title)} default_direction asc } + project_contact { + label {[_ invoices.iv_offer_project_contact]} + orderby_desc {lower(p2.last_name) desc, lower(p2.first_names) desc} + orderby_asc {lower(p2.last_name) asc, lower(p2.first_names) asc} + default_direction asc + } amount_total { label {[_ invoices.iv_offer_amount_total]} orderby {t.amount_total} @@ -198,11 +209,12 @@ } -db_multirow -extend {creator_link edit_link delete_link title_link project_link} iv_offer iv_offer {} { +db_multirow -extend {creator_link contact_link edit_link delete_link title_link project_link} iv_offer iv_offer {} { # Ugly hack. We should find out which contact package is linked # aso. asf. set creator_link "/contacts/$creation_user" + set contact_link "/contacts/$contact_id" set edit_link [export_vars -base "${base_url}offer-ae" {offer_id}] set title_link [export_vars -base "${base_url}offer-ae" {offer_id {mode display}}] set delete_link [export_vars -base "${base_url}offer-delete" {offer_id}] Index: openacs-4/packages/invoices/lib/offer-list.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/lib/offer-list.xql,v diff -u -r1.5 -r1.6 --- openacs-4/packages/invoices/lib/offer-list.xql 11 Oct 2005 15:23:28 -0000 1.5 +++ openacs-4/packages/invoices/lib/offer-list.xql 14 Oct 2005 06:25:03 -0000 1.6 @@ -20,10 +20,12 @@ to_char(o.creation_date, :timestamp_format) as creation_date, to_char(t.accepted_date, :timestamp_format) as accepted_date, to_char(t.finish_date, :timestamp_format) as finish_date, - pi.item_id as project_id, pr.title as project_title, t.status + pi.item_id as project_id, pr.title as project_title, t.status, + pp.contact_id, p2.first_names as contact_first_names, + p2.last_name as contact_last_name from cr_folders cf, cr_revisions cr, iv_offers t, acs_objects o, persons p, cr_items ci, acs_rels r, - cr_items pi, cr_revisions pr, pm_projects pp + cr_items pi, cr_revisions pr, pm_projects pp, persons p2 where cr.revision_id = ci.latest_revision and t.offer_id = cr.revision_id and ci.parent_id = cf.folder_id @@ -34,6 +36,7 @@ and r.object_id_two = pi.item_id and pr.revision_id = pi.latest_revision and pp.project_id = pr.revision_id + and p2.person_id = pp.contact_id [template::list::filter_where_clauses -and -name iv_offer] [template::list::page_where_clause -and -name iv_offer -key cr.item_id] [template::list::orderby_clause -name iv_offer -orderby] @@ -47,7 +50,7 @@ select cr.item_id as offer_id from cr_folders cf, cr_revisions cr, iv_offers t, acs_objects o, persons p, cr_items ci, acs_rels r, - cr_items pi, cr_revisions pr, pm_projects pp + cr_items pi, cr_revisions pr, pm_projects pp, persons p2 where cr.revision_id = ci.latest_revision and t.offer_id = cr.revision_id and ci.parent_id = cf.folder_id @@ -58,6 +61,7 @@ and r.object_id_two = pi.item_id and pr.revision_id = pi.latest_revision and pp.project_id = pr.revision_id + and p2.person_id = pp.contact_id [template::list::filter_where_clauses -and -name iv_offer] [template::list::orderby_clause -name iv_offer -orderby] 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.2 -r1.3 --- openacs-4/packages/invoices/lib/projects-billable.tcl 13 Oct 2005 17:11:54 -0000 1.2 +++ openacs-4/packages/invoices/lib/projects-billable.tcl 14 Oct 2005 06:25:03 -0000 1.3 @@ -1,5 +1,5 @@ set required_param_list [list organization_id] -set optional_param_list [list orderby elements base_url package_id] +set optional_param_list [list orderby elements base_url package_id no_actions_p] set optional_unset_list [list] foreach required_param $required_param_list { @@ -26,6 +26,10 @@ append row_list "$element {}\n" } +if {[empty_string_p $no_actions_p]} { + set no_actions_p 0 +} + if {![exists_and_not_null format]} { set format "normal" } @@ -54,7 +58,13 @@ set currency [iv::price_list::get_currency -organization_id $organization_id] set contacts_url [apm_package_url_from_key contacts] -set actions [list "[_ invoices.iv_invoice_New]" "${base_url}invoice-ae" "[_ invoices.iv_invoice_New2]" ] +if {$no_actions_p} { + set actions "" + set bulk_id_list "" +} else { + set actions [list "[_ invoices.iv_invoice_New]" "${base_url}invoice-ae" "[_ invoices.iv_invoice_New2]" ] + set bulk_id_list [list organization_id] +} template::list::create \ -name projects \ @@ -91,7 +101,7 @@ label {[_ invoices.iv_invoice_closed_date]} } } -bulk_actions $actions \ - -bulk_action_export_vars {organization_id} \ + -bulk_action_export_vars $bulk_id_list \ -sub_class narrow \ -orderby { default_value project_id 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.6 -r1.7 --- openacs-4/packages/invoices/tcl/invoice-procs.tcl 11 Oct 2005 15:23:28 -0000 1.6 +++ openacs-4/packages/invoices/tcl/invoice-procs.tcl 14 Oct 2005 06:25:03 -0000 1.7 @@ -61,6 +61,7 @@ [list payment_days $payment_days] \ [list vat_percent $vat_percent] \ [list vat $vat] \ + [list status new] \ [list cancelled_p f] ] ] } @@ -110,6 +111,7 @@ [list payment_days $payment_days] \ [list vat_percent $vat_percent] \ [list vat $vat] \ + [list status new] \ [list cancelled_p f] ] ] } Index: openacs-4/packages/invoices/tcl/offer-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/tcl/offer-procs.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/invoices/tcl/offer-procs.tcl 11 Oct 2005 15:23:28 -0000 1.6 +++ openacs-4/packages/invoices/tcl/offer-procs.tcl 14 Oct 2005 06:25:03 -0000 1.7 @@ -58,6 +58,7 @@ [list payment_days $payment_days] \ [list vat_percent $vat_percent] \ [list vat $vat] \ + [list status new] \ [list credit_percent $credit_percent] ] ] } Index: openacs-4/packages/invoices/www/invoice-ae.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/invoice-ae.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/invoices/www/invoice-ae.tcl 11 Oct 2005 15:23:29 -0000 1.6 +++ openacs-4/packages/invoices/www/invoice-ae.tcl 14 Oct 2005 06:25:03 -0000 1.7 @@ -355,7 +355,7 @@ # foreach offer_id: check if there's an item that's not billed -> status new, else status billed foreach offer_id $offer_ids { - db_0or1row check_offer_status {} + set unbilled_items [db_string check_offer_status {} -default 0] if {$unbilled_items == 0} { # all offer items billed Index: openacs-4/packages/invoices/www/invoice-send.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/invoice-send.adp,v diff -u -r1.2 -r1.3 --- openacs-4/packages/invoices/www/invoice-send.adp 11 Oct 2005 15:23:29 -0000 1.2 +++ openacs-4/packages/invoices/www/invoice-send.adp 14 Oct 2005 06:25:03 -0000 1.3 @@ -3,6 +3,6 @@ @context;noquote@ Index: openacs-4/packages/invoices/www/invoice-send.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/invoice-send.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/invoices/www/invoice-send.tcl 11 Oct 2005 15:23:29 -0000 1.6 +++ openacs-4/packages/invoices/www/invoice-send.tcl 14 Oct 2005 06:25:03 -0000 1.7 @@ -51,27 +51,15 @@ set pdf_file [text_templates::create_pdf_from_html -html_content "$invoice_text"] if {![empty_string_p $pdf_file]} { set file_size [file size $pdf_file] - set file_ids [cr_import_content -title "Invoice_${invoice_id}.pdf" -description "PDF version of this offer" $invoice_id $pdf_file $file_size application/pdf "[clock seconds]-[expr round([ns_rand]*100000)]"]] - set return_url [export_vars -base invoice-pdf {invoice_id {file_id $file_ids}}] + set file_ids [cr_import_content -title "Invoice_${invoice_id}.pdf" -description "PDF version of this offer" $invoice_id $pdf_file $file_size application/pdf "[clock seconds]-[expr round([ns_rand]*100000)]"] + set return_url [export_vars -base invoice-pdf {invoice_id {file_id $file_ids}}] } +} else { + set return_url [export_vars -base invoice-list {organization_id}] } - -set return_url [export_vars -base invoice-list {organization_id}] -set party_ids [contact::util::get_employees -organization_id $organization_id] - -set parties_new [list] -foreach party_id $party_ids { - - # Check if the party has a valid e-mail address - if {![empty_string_p [cc_email_from_party $party_id]]} { - lappend parties_new $party_id - } +if {[empty_string_p [cc_email_from_party $recipient_id]]} { + ad_return_error "No Recipient" "The recipient does not have a valid e-mail address. Please go back and make sure that you provide an e-mail address first." } -if {[empty_string_p $parties_new]} { - ad_return_error "No Recipient" "None of the recipients has a valid e-mail address. Please go back and make sure that you provide an e-mail address first." -} else { - set party_ids $parties_new -} ad_return_template Index: openacs-4/packages/invoices/www/offer-accept-2.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/offer-accept-2.adp,v diff -u -r1.3 -r1.4 --- openacs-4/packages/invoices/www/offer-accept-2.adp 11 Oct 2005 15:23:29 -0000 1.3 +++ openacs-4/packages/invoices/www/offer-accept-2.adp 14 Oct 2005 06:25:03 -0000 1.4 @@ -3,7 +3,7 @@ @context;noquote@ Index: openacs-4/packages/invoices/www/offer-accept-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/offer-accept-2.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/invoices/www/offer-accept-2.tcl 11 Oct 2005 15:23:29 -0000 1.4 +++ openacs-4/packages/invoices/www/offer-accept-2.tcl 14 Oct 2005 06:25:03 -0000 1.5 @@ -36,21 +36,10 @@ } } -set parties_new [list] -foreach party_id $party_ids { - - # Check if the party has a valid e-mail address - if {![empty_string_p [cc_email_from_party $party_id]]} { - lappend parties_new $party_id - } +if {[empty_string_p [cc_email_from_party $contact_id]]} { + ad_return_error "No Recipient" "The recipient does not have a valid e-mail address. Please go back and make sure that you provide an e-mail address first." } -if {[empty_string_p $parties_new]} { - ad_return_error "No Recipient" "None of the recipients has a valid e-mail address. Please go back and make sure that you provide an e-mail address first." -} else { - set party_ids $parties_new -} - set cancel_url [export_vars -base offer-list {organization_id}] set invoice_url [site_node::get_package_url -package_key invoices] set return_url [export_vars -base "${invoice_url}offer-ae" {offer_id {mode display}}] Index: openacs-4/packages/invoices/www/offer-ae.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/offer-ae.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/invoices/www/offer-ae.tcl 6 Sep 2005 23:01:24 -0000 1.2 +++ openacs-4/packages/invoices/www/offer-ae.tcl 14 Oct 2005 06:25:03 -0000 1.3 @@ -379,6 +379,7 @@ [list [list "item_units.${i}:float,optional" \ [list label "[_ invoices.iv_offer_item_item_units]"] \ [list html [list size 5 maxlength 5 onChange calculateItemAmount(${i})]] \ + [list value 0] \ [list help_text "[_ invoices.iv_offer_item_item_units_help]"] \ [list after_html "[_ invoices.units]"] \ [list section "[_ invoices.iv_offer_item_1] $i"] ] ] Index: openacs-4/packages/invoices/www/offer-send.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/offer-send.adp,v diff -u -r1.2 -r1.3 --- openacs-4/packages/invoices/www/offer-send.adp 11 Oct 2005 15:23:29 -0000 1.2 +++ openacs-4/packages/invoices/www/offer-send.adp 14 Oct 2005 06:25:03 -0000 1.3 @@ -3,6 +3,6 @@ @context;noquote@ Index: openacs-4/packages/invoices/www/offer-send.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/offer-send.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/invoices/www/offer-send.tcl 11 Oct 2005 15:23:29 -0000 1.6 +++ openacs-4/packages/invoices/www/offer-send.tcl 14 Oct 2005 06:25:03 -0000 1.7 @@ -55,19 +55,8 @@ set return_url [export_vars -base offer-list {organization_id}] } -set party_ids [contact::util::get_employees -organization_id $organization_id] -set parties_new [list] -foreach party_id $party_ids { - - # Check if the party has a valid e-mail address - if {![empty_string_p [cc_email_from_party $party_id]]} { - lappend parties_new $party_id - } +if {[empty_string_p [cc_email_from_party $contact_id]]} { + ad_return_error "No Recipient" "The recipient does not have a valid e-mail address. Please go back and make sure that you provide an e-mail address first." } -if {[empty_string_p $parties_new]} { - ad_return_error "No Recipient" "None of the recipients has a valid e-mail address. Please go back and make sure that you provide an e-mail address first." -} else { - set party_ids $parties_new -} ad_return_template