Index: openacs-4/packages/invoices/invoices.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/invoices.info,v diff -u -r1.18 -r1.19 --- openacs-4/packages/invoices/invoices.info 27 Dec 2005 16:39:33 -0000 1.18 +++ openacs-4/packages/invoices/invoices.info 31 Dec 2005 07:36:23 -0000 1.19 @@ -7,15 +7,15 @@ f t - + Timo Hentschel Invoices package that will collect costs to invoice items in invoices and store data about received payment. 2005-11-15 Cognovis Collect costs to invoice items and invoices, store payment information. 0 - + @@ -24,7 +24,8 @@ - + + 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.19 -r1.20 --- openacs-4/packages/invoices/catalog/invoices.de_DE.ISO-8859-1.xml 28 Dec 2005 08:09:09 -0000 1.19 +++ openacs-4/packages/invoices/catalog/invoices.de_DE.ISO-8859-1.xml 31 Dec 2005 07:36:23 -0000 1.20 @@ -189,13 +189,17 @@ Mehrwertsteuersatz Mehrwertsteuersatz welcher der Rechnung hinzugef�gt wird Rechnung ansehen + Rechnungen ansehen + <html><body>%contact.salutation%,<p>anbei finden Sie die Rechnungen %invoice_nrs%.<p>Mit freundlichen Gr&uuml;&szlig;en,<p>@am_name@<br>Kundenberatung</html></body> + Rechnungen # %invoice_nrs% Rechnungen von %long_month% %year%: Rechnungen des Jahres %year%: Projektaufstellung Projektaufstellungen Angebot akzeptieren Akzeptiert am - <html><body><h3>Auftragsbest�tigung</h3>%data.contact_salutation%, <p>Vielen Dank f�r Ihren Auftrag. Wir werden Sie so schnell wie m�glich diesbez�glich kontaktieren.<p>Mit freundlichen Gr&uuml;&szlig;en,<br>WIENERS + WIENERS GmbH<br></html></body> + <html><body>%data.contact_salutation%, <p>Vielen Dank f�r Ihren Auftrag!<p> +Die Details entnehmen Sie bitte der angeh�ngten PDF-Datei.<p>Mit freundlichen Gr&uuml;&szlig;en,<p>@am_name@<br>Kundenberatung</html></body> Auftragsbest�tigung # %offer_nr% Vielen Dank f�r die Annahme unseres Angebots. Wir werden Sie so schnell wie m�glich diesbez�glich kontaktieren. Kostenaufstellung f�r "%organization_name%" @@ -204,7 +208,7 @@ Summe Automatisch errechnete Summe aus der Summation der angebotenen Positionen Gesamtsumme - Gesmatsumme der Rechnung. Diese kann von der Summe der einzelnen angebotenen Positionen abweichen. + Gesamtsumme der Rechnung. Hier kann ein Rabatt auf die Gesamtsumme gew�hrt werden. <b>Interner Kommentar</b> Interner Kommentar der nicht dem Kunden gezeigt wird. Anzahl Positionen @@ -220,7 +224,7 @@ Beschreibung der Kostenaufstellung Projektaufstellung �ndern Sie d�rfen keine akzeptierte oder berechnete Kostenaufstellung �ndern. - <html><body><h3>Angebot</h3>%data.contact_salutation%,<p>anbei unser Angebot an Sie.<p>Um dieses Angebot anzunehmen, klicken Sie bitte <a href="%accept_link%">hier</a>.<p>Mit freundlichen Gr��en,<br>WIENERS + WIENERS GmbH<br></html></body> + <html><body>%data.contact_salutation%,<p>anbei erhalten Sie das gew�nschte Angebot als PDF-Datei.<p>Um das Angebot freizugeben, klicken Sie bitte <a href="%accept_link%">hier</a>.<p>Mit freundlichen Gr��en,<p>@am_name@<br>Kundenberatung</html></body> Angebot # %offer_nr% Datei anh�ngen Dateien l�schen @@ -266,7 +270,7 @@ Lektorat Adaption Sprachen - Alternativ zum Titel kann eine Quell und Zielsprache ausgew�hlt werden. + <b><font color="red">Alternativ</font> zum Titel</b> kann eine Quell und Zielsprache ausgew�hlt werden. Titel, der in dem Angebot/der Rechnung angezeigt wird Mehrwertsteuer Kostenposition ansehen 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.22 -r1.23 --- openacs-4/packages/invoices/catalog/invoices.en_US.ISO-8859-1.xml 27 Dec 2005 16:39:34 -0000 1.22 +++ openacs-4/packages/invoices/catalog/invoices.en_US.ISO-8859-1.xml 31 Dec 2005 07:36:23 -0000 1.23 @@ -1,5 +1,5 @@ - + Accepted Offers Accepted on @@ -189,6 +189,9 @@ %VAT Percentage of VAT added in the invoice View Invoice + View Invoices + <html><body><h3>Invoices</h3>%contact.salutation%,<p>see attached invoices %invoice_nrs%.<p>Best wishes,<br>WIENERS + WIENERS GmbH<br></html></body> + Invoices # %invoice_nrs% Invoices of %long_month% %year%: Invoices of year %year%: Cost Sheet 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.8 -r1.9 --- openacs-4/packages/invoices/lib/invoice-list.tcl 14 Dec 2005 17:41:16 -0000 1.8 +++ openacs-4/packages/invoices/lib/invoice-list.tcl 31 Dec 2005 07:36:24 -0000 1.9 @@ -34,7 +34,7 @@ set user_id [ad_conn user_id] set date_format [lc_get formbuilder_date_format] set timestamp_format "$date_format [lc_get formbuilder_time_format]" -set bulk_actions [list "[_ invoices.iv_invoice_pay]" "${base_url}invoice-pay" "[_ invoices.iv_invoice_pay]"] +set bulk_actions [list "[_ invoices.iv_invoice_send]" "${base_url}invoices-view" "[_ invoices.iv_invoice_send]" "[_ invoices.iv_invoice_pay]" "${base_url}invoice-pay" "[_ invoices.iv_invoice_pay]"] set invoice_cancel_p [permission::permission_p -party_id $user_id -object_id $package_id -privilege invoice_cancel] set return_url [ad_return_url] @@ -150,7 +150,7 @@ } -orderby_name orderby -html {width 100%} \ -page_size_variable_p 1 \ -page_size $page_size \ - -page_flush_p 0 \ + -page_flush_p 1 \ -page_query_name iv_invoice_paginated \ -pass_properties {invoice_cancel_p} \ -filters {organization_id {}} \ Index: openacs-4/packages/invoices/lib/offer-items-list.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/lib/offer-items-list.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/invoices/lib/offer-items-list.tcl 9 Nov 2005 19:28:55 -0000 1.5 +++ openacs-4/packages/invoices/lib/offer-items-list.tcl 31 Dec 2005 07:36:24 -0000 1.6 @@ -241,7 +241,7 @@ } \ -html {width 100%} \ -page_size $page_size \ - -page_flush_p 0 \ + -page_flush_p 1 \ -page_query_name "offer_items_paginated" \ -pass_properties return_url \ -groupby { 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.8 -r1.9 --- openacs-4/packages/invoices/lib/offer-list.tcl 3 Nov 2005 22:49:12 -0000 1.8 +++ openacs-4/packages/invoices/lib/offer-list.tcl 31 Dec 2005 07:36:24 -0000 1.9 @@ -184,7 +184,7 @@ } -orderby_name orderby \ -page_size_variable_p 1 \ -page_size $page_size \ - -page_flush_p 0 \ + -page_flush_p 1 \ -page_query_name iv_offer_paginated \ -filters { organization_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.13 -r1.14 --- openacs-4/packages/invoices/tcl/invoice-procs.tcl 27 Dec 2005 21:51:43 -0000 1.13 +++ openacs-4/packages/invoices/tcl/invoice-procs.tcl 31 Dec 2005 07:36:24 -0000 1.14 @@ -211,11 +211,8 @@ 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)" - set rec_organization_id [contact::util::get_employee_organization -employee_id $data(recipient_id)] set orga_revision_id [content::item::get_best_revision -item_id $data(organization_id)] - 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 $data(recipient_id)] # invoice contact data @@ -231,6 +228,7 @@ # invoice recipient data if {[organization::organization_p -party_id $data(recipient_id)]} { # recipient is organization + set rec_organization_id $data(recipient_id) 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] @@ -240,9 +238,14 @@ set attribute_list {address town_line country country_code} } else { # recipient is person + set rec_organization_id [contact::util::get_employee_organization -employee_id $data(recipient_id)] contact::employee::get -employee_id $data(recipient_id) -array recipient_data set attribute_list {name company_name_ext address town_line country country_code salutation salutation_letter} } + set rec_orga_revision_id [content::item::get_best_revision -item_id $rec_organization_id] + set rec_client_id [ams::value -attribute_name "client_id" -object_id $rec_orga_revision_id -locale $rec_locale] + set data(rec_vat_ident_number) [ams::value -attribute_name "VAT_ident_number" -object_id $rec_orga_revision_id -locale $rec_locale] + foreach attribute $attribute_list { if {[info exists recipient_data($attribute)]} { set data(rec_$attribute) $recipient_data($attribute) @@ -278,6 +281,14 @@ set data(amount_sum) [lc_numeric [format "%.2f" $data(amount_sum)] "" $locale] set data(total_amount) [lc_numeric [format "%.2f" $data(total_amount)] "" $locale] + # Get the account manager information for the organization. + set account_manager_id [contacts::util::get_account_manager -organization_id $data(organization_id)] + if {$account_manager_id ne ""} { + set am_name "[contact::name -party_id [lindex $account_manager_id 0]]" + } else { + set am_name "[contact::name -party_id [parameter::get_from_package_key -package_key contacts -parameter DefaultOrganizationID]]" + } + # parse invoice email text eval [template::adp_compile -string [lang::util::localize $email_text $contact_locale]] set final_content [list $__adp_output] 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.15 -r1.16 --- openacs-4/packages/invoices/tcl/offer-procs.tcl 27 Dec 2005 21:51:43 -0000 1.15 +++ openacs-4/packages/invoices/tcl/offer-procs.tcl 31 Dec 2005 07:36:24 -0000 1.16 @@ -244,6 +244,14 @@ set category [lang::util::localize [category::get_name $category_id] $locale] } + # Get the account manager information for the organization. + set account_manager_id [contacts::util::get_account_manager -organization_id $data(organization_id)] + if {$account_manager_id ne ""} { + set am_name "[contact::name -party_id [lindex $account_manager_id 0]]" + } else { + set am_name "[contact::name -party_id [parameter::get_from_package_key -package_key contacts -parameter DefaultOrganizationID]]" + } + # parse offer email text eval [template::adp_compile -string [lang::util::localize $email_text $locale]] set final_content [list $__adp_output] 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.3 -r1.4 --- openacs-4/packages/invoices/www/invoice-send.adp 14 Oct 2005 06:25:03 -0000 1.3 +++ openacs-4/packages/invoices/www/invoice-send.adp 31 Dec 2005 07:36:24 -0000 1.4 @@ -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.11 -r1.12 --- openacs-4/packages/invoices/www/invoice-send.tcl 27 Dec 2005 20:17:41 -0000 1.11 +++ openacs-4/packages/invoices/www/invoice-send.tcl 31 Dec 2005 07:36:24 -0000 1.12 @@ -57,8 +57,8 @@ lappend document_types invoice_copy } -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 [cc_email_from_party $contact_id]]} { + ad_return_error "No Recipient" "The contact does not have a valid e-mail address. Please go back and make sure that you provide an e-mail address first." ad_script_abort } Index: openacs-4/packages/invoices/www/invoice-send.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/invoice-send.xql,v diff -u -r1.4 -r1.5 --- openacs-4/packages/invoices/www/invoice-send.xql 27 Dec 2005 16:39:35 -0000 1.4 +++ openacs-4/packages/invoices/www/invoice-send.xql 31 Dec 2005 07:36:24 -0000 1.5 @@ -18,7 +18,7 @@ update cr_items set publish_status = 'expired' - where item_id = (select item_id from cr_revisions where revision_id = :file_id) + where item_id = :file_id Index: openacs-4/packages/invoices/www/offer-accept-2.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/offer-accept-2.xql,v diff -u -r1.4 -r1.5 --- openacs-4/packages/invoices/www/offer-accept-2.xql 27 Dec 2005 18:45:40 -0000 1.4 +++ openacs-4/packages/invoices/www/offer-accept-2.xql 31 Dec 2005 07:36:24 -0000 1.5 @@ -28,7 +28,7 @@ update cr_items set publish_status = 'expired' - where item_id = (select item_id from cr_revisions where revision_id = :file_ids) + where item_id = :file_ids 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.15 -r1.16 --- openacs-4/packages/invoices/www/offer-ae.tcl 27 Dec 2005 16:39:35 -0000 1.15 +++ openacs-4/packages/invoices/www/offer-ae.tcl 31 Dec 2005 07:36:24 -0000 1.16 @@ -736,14 +736,15 @@ set n_bytes [file size $tmp_filename] if { $n_bytes > 0 } { - cr_import_content -title $filename $offer_id $tmp_filename $n_bytes $file_mimetype $filename + set file_rev_id [cr_import_content -title $filename $offer_id $tmp_filename $n_bytes $file_mimetype $filename] + content::item::set_live_revision -revision_id $file_rev_id } } # delete files if {[info exists delete_files]} { foreach file_id $delete_files { - db_exec_plsql delete_file {} + content::item::delete -item_id $file_id set path "[cr_fs_path][cr_create_content_file_path $file_id ""]" foreach revision [glob -directory $path "*"] { Index: openacs-4/packages/invoices/www/offer-send.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/offer-send.xql,v diff -u -r1.5 -r1.6 --- openacs-4/packages/invoices/www/offer-send.xql 27 Dec 2005 16:39:35 -0000 1.5 +++ openacs-4/packages/invoices/www/offer-send.xql 31 Dec 2005 07:36:24 -0000 1.6 @@ -28,7 +28,7 @@ update cr_items set publish_status = 'expired' - where item_id = (select item_id from cr_revisions where revision_id = :file_ids) + where item_id = :file_ids