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.20 -r1.21
--- openacs-4/packages/invoices/catalog/invoices.de_DE.ISO-8859-1.xml 31 Dec 2005 07:36:23 -0000 1.20
+++ openacs-4/packages/invoices/catalog/invoices.de_DE.ISO-8859-1.xml 4 Jan 2006 08:06:42 -0000 1.21
@@ -66,6 +66,7 @@
Angebote
Gruppieren nach
Rechnung
+ Stornieren
Rechnungsposition
Positionsnummer
Title der Rechnungsposition
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.23 -r1.24
--- openacs-4/packages/invoices/catalog/invoices.en_US.ISO-8859-1.xml 31 Dec 2005 07:36:23 -0000 1.23
+++ openacs-4/packages/invoices/catalog/invoices.en_US.ISO-8859-1.xml 4 Jan 2006 08:06:42 -0000 1.24
@@ -66,6 +66,7 @@
Offers
Group By
Invoice
+ Cancel
Invoice Item
Invoice item number
Invoice Item Title
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.9 -r1.10
--- openacs-4/packages/invoices/lib/invoice-list.tcl 31 Dec 2005 07:36:24 -0000 1.9
+++ openacs-4/packages/invoices/lib/invoice-list.tcl 4 Jan 2006 08:06:45 -0000 1.10
@@ -95,9 +95,9 @@
display_template {[_ invoices.iv_invoice_status_@iv_invoice.status@]}
}
action {
- display_template {#invoices.Edit# #invoices.Cancel# #invoices.Delete#}
- }
- } -actions $actions -sub_class narrow \
+ display_template {#invoices.Edit# #invoices.Invoice_Cancel# #invoices.Delete#}
+ }
+ } -actions $actions -sub_class narrow \
-bulk_actions $bulk_actions \
-bulk_action_export_vars {return_url} \
-orderby {
@@ -170,7 +170,7 @@
set contacts_p [apm_package_installed_p contacts]
-db_multirow -extend {creator_link edit_link cancel_link delete_link recipient organization_id} iv_invoice iv_invoice {} {
+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 edit_link [export_vars -base "${base_url}invoice-ae" {invoice_id}]
Index: openacs-4/packages/invoices/sql/postgresql/invoices-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/sql/postgresql/invoices-create.sql,v
diff -u -r1.8 -r1.9
--- openacs-4/packages/invoices/sql/postgresql/invoices-create.sql 27 Dec 2005 16:39:34 -0000 1.8
+++ openacs-4/packages/invoices/sql/postgresql/invoices-create.sql 4 Jan 2006 08:06:45 -0000 1.9
@@ -326,10 +326,3 @@
select acs_privilege__add_child('admin','invoice_cancel');
select acs_privilege__add_child('admin','invoice_export');
end;
-
-
--- insert into contact_message_types (message_type,pretty_name) values ('offer','#invoices.template_offer#');
--- insert into contact_message_types (message_type,pretty_name) values ('offer_accepted','#invoices.template_offer_accepted#');
--- insert into contact_message_types (message_type,pretty_name) values ('invoice','#invoices.template_invoice#');
--- insert into contact_message_types (message_type,pretty_name) values ('invoice_cancel','#invoices.template_invoice_cancel#');
--- insert into contact_message_types (message_type,pretty_name) values ('invoice_credit','#invoices.template_invoice_credit#');
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.14 -r1.15
--- openacs-4/packages/invoices/tcl/invoice-procs.tcl 31 Dec 2005 07:36:24 -0000 1.14
+++ openacs-4/packages/invoices/tcl/invoice-procs.tcl 4 Jan 2006 08:06:47 -0000 1.15
@@ -256,14 +256,15 @@
# get the invoice item data
set sum 0.
- db_multirow -local -extend {amount_sum amount_total category} items invoice_items {} {
+ db_multirow -local -extend {amount_sum amount_total amount_diff category} items invoice_items {} {
if {[empty_string_p $credit_percent]} {
set credit_percent 0
}
set item_units [format "%.2f" [expr $item_units * (1. + ($credit_percent / 100.))]]
set amount_sum [format "%.2f" [expr $item_units * $price_per_unit]]
set amount_total [format "%.2f" [expr (1. - ($rebate / 100.)) * $amount_sum]]
set sum [expr $sum + $amount_total]
+ set amount_diff [format "%.2f" [expr $amount_total - $amount_sum]]
set amount_total [lc_numeric $amount_total "" $locale]
set amount_sum [lc_numeric $amount_sum "" $locale]
set price_per_unit [lc_numeric [format "%.2f" $price_per_unit] "" $locale]
@@ -272,14 +273,18 @@
set category [lang::util::localize [category::get_name $category_id] $locale]
}
- set data(amount_sum) $sum
- set data(total_amount) [expr $sum + $amount_diff]
- set data(vat) [expr $data(vat_percent) * $data(total_amount) / 100.]
- set data(final_amount) [lc_numeric [format "%.2f" [expr $data(total_amount)+$data(vat)]] "" $locale]
+ # It is possible that you have an invoice without items, e.g. a credit invoice
+ if {$sum ne "0."} {
+ set data(amount_sum) $sum
+ set data(total_amount) [expr $sum + $amount_diff]
+ set data(vat) [expr $data(vat_percent) * $data(total_amount) / 100.]
+ set data(final_amount) [lc_numeric [format "%.2f" [expr $data(total_amount)+$data(vat)]] "" $locale]
+ set data(vat) [lc_numeric [format "%.2f" $data(vat)] "" $locale]
+ set data(amount_sum) [lc_numeric [format "%.2f" $data(amount_sum)] "" $locale]
+ set data(total_amount) [lc_numeric [format "%.2f" $data(total_amount)] "" $locale]
+ }
+
set data(vat_percent) [lc_numeric [format "%.1f" $data(vat_percent)] "" $locale]
- set data(vat) [lc_numeric [format "%.2f" $data(vat)] "" $locale]
- 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)]
Index: openacs-4/packages/invoices/tcl/invoice-procs.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/tcl/invoice-procs.xql,v
diff -u -r1.6 -r1.7
--- openacs-4/packages/invoices/tcl/invoice-procs.xql 27 Dec 2005 16:39:35 -0000 1.6
+++ openacs-4/packages/invoices/tcl/invoice-procs.xql 4 Jan 2006 08:06:47 -0000 1.7
@@ -103,7 +103,7 @@
and pi.latest_revision = pr.revision_id
and pr.revision_id = p.project_id
and o.offer_id = ofi.offer_id
- order by ii.sort_order
+ order by pr.title, ii.sort_order
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.19 -r1.20
--- openacs-4/packages/invoices/www/invoice-ae.tcl 27 Dec 2005 16:39:35 -0000 1.19
+++ openacs-4/packages/invoices/www/invoice-ae.tcl 4 Jan 2006 08:06:48 -0000 1.20
@@ -138,7 +138,7 @@
set recipient_options [db_list_of_lists cancellation_recipients {}]
} elseif {$cur_total_amount < 0} {
# credit: get recipients from organization
- set recipient_options [db_list_of_lists credit_recipients {}]
+ set recipient_options [contact::util::get_employees_list_of_lists -organization_id $organization_id]
set contact_options $recipient_options
} else {
# normal invoice: get recipients from projects
Index: openacs-4/packages/invoices/www/invoice-cancellation.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/invoice-cancellation.tcl,v
diff -u -r1.3 -r1.4
--- openacs-4/packages/invoices/www/invoice-cancellation.tcl 27 Oct 2005 18:11:24 -0000 1.3
+++ openacs-4/packages/invoices/www/invoice-cancellation.tcl 4 Jan 2006 08:06:48 -0000 1.4
@@ -29,12 +29,14 @@
set language [lang::conn::language]
set currency_options [db_list_of_lists currencies {}]
+set contact_options [db_list_of_lists cancellation_contacts {}]
set recipient_options [db_list_of_lists cancellation_recipients {}]
ad_form -name iv_invoice_cancel_form -action invoice-cancellation -export {organization_id parent_id} -form {
{invoice_id:key}
{organization_name:text(inform) {label "[_ invoices.iv_invoice_organization]"} {value $organization_name} {help_text "[_ invoices.iv_invoice_organization_help]"}}
+ {contact_id:integer(select),optional {label "[_ invoices.iv_invoice_contact]"} {options $contact_options} {help_text "[_ invoices.iv_invoice_contact_help]"}}
{recipient_id:integer(select),optional {label "[_ invoices.iv_invoice_recipient]"} {options $recipient_options} {help_text "[_ invoices.iv_invoice_recipient_help]"}}
{title:text {label "[_ invoices.iv_invoice_Title]"} {html {size 80 maxlength 1000}} {help_text "[_ invoices.iv_invoice_Title_help]"}}
{description:text(textarea),optional {label "[_ invoices.iv_invoice_Description]"} {html {rows 5 cols 80}} {help_text "[_ invoices.iv_invoice_Description_help]"}}
@@ -69,13 +71,15 @@
set vat [expr $total_amount * $vat_percent / 100.]
set vat [format "%.2f" $vat]
- set new_invoice_rev_id [iv::invoice::new \
+ set new_invoice_rev_id [iv::invoice::new \
-parent_invoice_id $parent_id \
-title $title \
-description $description \
-invoice_nr $invoice_nr \
-organization_id $organization_id \
+ -contact_id $contact_id \
-recipient_id $recipient_id \
+ -amount_sum $total_amount \
-total_amount $total_amount \
-currency $currency \
-due_date $due_date \
@@ -86,7 +90,7 @@
set parent_item_id [content::revision::item_id -revision_id $parent_id]
db_1row get_credit_offer {}
- if {[db_0or1row get_old_credit {} && $old_credit > 0.} {
+ if {[db_0or1row get_old_credit {}] && $old_credit > 0.} {
# cancelled invoice has credit
set invoice_id [content::revision::item_id -revision_id $new_invoice_rev_id]
set total_credit "-$old_credit"
Index: openacs-4/packages/invoices/www/invoice-cancellation.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/invoice-cancellation.xql,v
diff -u -r1.4 -r1.5
--- openacs-4/packages/invoices/www/invoice-cancellation.xql 14 Dec 2005 22:06:38 -0000 1.4
+++ openacs-4/packages/invoices/www/invoice-cancellation.xql 4 Jan 2006 08:06:48 -0000 1.5
@@ -1,6 +1,18 @@
+
+
+
+ select p.first_names || ' ' || p.last_name, p.person_id
+ from persons p, iv_invoices i
+ where i.invoice_id = :parent_id
+ and p.person_id = i.contact_id
+ order by lower(p.last_name), lower(p.first_names)
+
+
+
+
Index: openacs-4/packages/invoices/www/invoice-credit.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/invoice-credit.tcl,v
diff -u -r1.4 -r1.5
--- openacs-4/packages/invoices/www/invoice-credit.tcl 3 Jan 2006 12:55:57 -0000 1.4
+++ openacs-4/packages/invoices/www/invoice-credit.tcl 4 Jan 2006 08:06:48 -0000 1.5
@@ -30,13 +30,8 @@
set currency_options [db_list_of_lists currencies {}]
# Get the list of valid recipients. These are employees of the organization
-set recipient_list [contact::util::get_employees -organization_id $organization_id]
-set recipient_options [list]
-foreach recipient_id $recipient_list {
- lappend recipient_options [list [person::name -person_id $recipient_id] $recipient_id]
-}
+set recipient_options [contact::util::get_employees_list_of_lists -organization_id $organization_id]
-
ad_form -name iv_invoice_credit_form -action invoice-credit -export {organization_id} -form {
{invoice_id:key}
{organization_name:text(inform) {label "[_ invoices.iv_invoice_organization]"} {value $organization_name} {help_text "[_ invoices.iv_invoice_organization_help]"}}
@@ -85,9 +80,11 @@
-title $title \
-description $description \
-invoice_nr $invoice_nr \
+ -contact_id $recipient_id \
-organization_id $organization_id \
-recipient_id $recipient_id \
-total_amount $total_amount \
+ -amount_sum $total_amount \
-currency $currency \
-due_date $due_date \
-vat_percent $vat_percent \
Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/invoices/www/invoice-credit.xql'.
Fisheye: No comparison available. Pass `N' to diff?
Index: openacs-4/packages/invoices/www/invoice-pdf.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/invoice-pdf.tcl,v
diff -u -r1.4 -r1.5
--- openacs-4/packages/invoices/www/invoice-pdf.tcl 27 Dec 2005 16:39:35 -0000 1.4
+++ openacs-4/packages/invoices/www/invoice-pdf.tcl 4 Jan 2006 08:06:48 -0000 1.5
@@ -28,6 +28,7 @@
set file_item_id [content::revision::item_id -revision_id $one_file]
content::item::move -item_id $file_item_id -target_folder_id $invoice_folder_id
db_dml set_publish_status {}
+ db_dml set_context_id {}
application_data_link::new -this_object_id $invoice_id -target_object_id $one_file
}
iv::invoice::set_status -invoice_id $invoice_id -status "billed"
Index: openacs-4/packages/invoices/www/invoice-pdf.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/invoice-pdf.xql,v
diff -u -r1.3 -r1.4
--- openacs-4/packages/invoices/www/invoice-pdf.xql 27 Dec 2005 16:39:35 -0000 1.3
+++ openacs-4/packages/invoices/www/invoice-pdf.xql 4 Jan 2006 08:06:48 -0000 1.4
@@ -22,4 +22,14 @@
+
+
+
+ update acs_objects
+ set context_id = :invoice_folder_id
+ where object_id = :file_item_id
+
+
+
+
Index: openacs-4/packages/invoices/www/invoice-send-1.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/invoice-send-1.tcl,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/invoices/www/invoice-send-1.tcl 27 Dec 2005 21:51:43 -0000 1.2
+++ openacs-4/packages/invoices/www/invoice-send-1.tcl 4 Jan 2006 08:06:48 -0000 1.3
@@ -17,7 +17,12 @@
set context [list [list [export_vars -base invoice-list {organization_id}] "[_ invoices.iv_invoice_2]"] [list [export_vars -base invoice-ae {invoice_id}] "[_ invoices.iv_invoice_View]"] $page_title]
-set rec_organization_id [contact::util::get_employee_organization -employee_id $recipient_id]
+if {[person::person_p -party_id $recipient_id]} {
+ set rec_organization_id [contact::util::get_employee_organization -employee_id $recipient_id]
+} else {
+ set rec_organization_id $recipient_id
+}
+
set rec_orga_revision_id [content::item::get_best_revision -item_id $rec_organization_id]
set invoice_copy [ams::value -attribute_name "invoice_copy" -object_id $rec_orga_revision_id]
@@ -27,7 +32,7 @@
{invoice_id:key}
}
-if {$organization_id != $rec_organization_id} {
+if {$contact_id != $recipient_id} {
ad_form -extend -name invoice_send -form {
{opening_p:text(radio) {label "[_ invoices.iv_invoice_opening_p]"} {options $boolean_options}}
}
Index: openacs-4/packages/invoices/www/invoice-send-1.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/invoice-send-1.xql,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/invoices/www/invoice-send-1.xql 27 Dec 2005 16:39:35 -0000 1.1
+++ openacs-4/packages/invoices/www/invoice-send-1.xql 4 Jan 2006 08:06:48 -0000 1.2
@@ -5,7 +5,7 @@
select i.invoice_nr, i.organization_id, i.parent_invoice_id, i.invoice_nr,
- i.total_amount, i.recipient_id, i.organization_id
+ i.total_amount, i.recipient_id, i.contact_id
from iv_invoices i, cr_items ii
where ii.latest_revision = i.invoice_id
and ii.item_id = :invoice_id
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.12 -r1.13
--- openacs-4/packages/invoices/www/invoice-send.tcl 31 Dec 2005 07:36:24 -0000 1.12
+++ openacs-4/packages/invoices/www/invoice-send.tcl 4 Jan 2006 08:06:48 -0000 1.13
@@ -104,7 +104,7 @@
}
if {[llength $file_ids] > 0} {
- set return_url [export_vars -base invoice-pdf {invoice_id {file_id $file_ids}}]
+ set return_url [export_vars -base invoice-pdf {invoice_id {file_id:multiple $file_ids}}]
} else {
set return_url [export_vars -base invoice-list {organization_id}]
}
Index: openacs-4/packages/invoices/www/offer-pdf.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/offer-pdf.tcl,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/invoices/www/offer-pdf.tcl 27 Dec 2005 16:39:35 -0000 1.2
+++ openacs-4/packages/invoices/www/offer-pdf.tcl 4 Jan 2006 08:06:48 -0000 1.3
@@ -38,6 +38,7 @@
content::item::move -item_id $file_item_id -target_folder_id $offer_folder_id
application_data_link::new -this_object_id $offer_id -target_object_id $file_id
db_dml set_publish_status {}
+ db_dml set_context_id {}
# Set the task by default to phone three days later.
set due_date [clock format [clock scan "3 days" -base [clock scan [dt_systime]]] -format "%Y-%m-%d"]
Index: openacs-4/packages/invoices/www/offer-pdf.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/offer-pdf.xql,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/invoices/www/offer-pdf.xql 27 Dec 2005 16:39:35 -0000 1.2
+++ openacs-4/packages/invoices/www/offer-pdf.xql 4 Jan 2006 08:06:48 -0000 1.3
@@ -33,4 +33,14 @@
+
+
+
+ update acs_objects
+ set context_id = :offer_folder_id
+ where object_id = :file_item_id
+
+
+
+
Index: openacs-4/packages/invoices/www/admin/index.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/admin/index.adp,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/invoices/www/admin/index.adp 15 Sep 2005 14:34:05 -0000 1.2
+++ openacs-4/packages/invoices/www/admin/index.adp 4 Jan 2006 08:06:55 -0000 1.3
@@ -5,5 +5,6 @@
Index: openacs-4/packages/invoices/www/admin/index.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/admin/index.tcl,v
diff -u -r1.3 -r1.4
--- openacs-4/packages/invoices/www/admin/index.tcl 16 Sep 2005 14:27:32 -0000 1.3
+++ openacs-4/packages/invoices/www/admin/index.tcl 4 Jan 2006 08:06:55 -0000 1.4
@@ -14,6 +14,8 @@
set context [list]
set categories_url "categories-admin"
set linking_url "linking"
-set parameter_url [export_vars -base "/shared/parameters" {{package_id "[ad_conn package_id]"} {return_url [ad_return_url]}}]
+set package_id [ad_conn package_id]
+set permission_url [export_vars -base "/permissions/one" {{object_id $package_id} {application_url [ad_return_url]}}]
+set parameter_url [export_vars -base "/shared/parameters" {package_id {return_url [ad_return_url]}}]
ad_return_template