Index: openacs-4/packages/invoices/invoices.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/invoices.info,v
diff -u -r1.28 -r1.29
--- openacs-4/packages/invoices/invoices.info 18 Jun 2006 11:42:25 -0000 1.28
+++ openacs-4/packages/invoices/invoices.info 4 Aug 2006 15:43:42 -0000 1.29
@@ -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
-
+
@@ -41,6 +41,7 @@
+
Index: openacs-4/packages/invoices/tcl/price-list-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/tcl/price-list-procs.tcl,v
diff -u -r1.4 -r1.5
--- openacs-4/packages/invoices/tcl/price-list-procs.tcl 29 Jun 2006 14:46:45 -0000 1.4
+++ openacs-4/packages/invoices/tcl/price-list-procs.tcl 4 Aug 2006 15:43:42 -0000 1.5
@@ -90,11 +90,13 @@
}
}
+# modified 2006/08/04 by cognovis/nfl: new logic related to the default price list id
ad_proc -public iv::price_list::get_list_id {
-organization_id:required
{-package_id ""}
} {
@author Timo Hentschel (timo@timohentschel.de)
+ @author Nils Lohse (nils.lohse@cognovis.de)
@creation-date 2005-07-01
Get id of customer price list (or default)
@@ -103,13 +105,52 @@
set package_id [ad_conn package_id]
}
- if {[db_0or1row check_customer_price_list {}] || [db_0or1row check_default_price_list {}]} {
- return $list_id
- } else {
- return ""
+ # --- 1) look, if there is a customer price list
+ if {[db_0or1row check_customer_price_list {}]} {
+ return $list_id
+ } else {
+ # --- 2) deliver default price list
+ set dpl_id [iv::price_list::get_default_list_id -package_id $package_id]
+ return $dpl_id
}
+
+# old code - used until 2006/08/04:
+# if {[db_0or1row check_customer_price_list {}] || [db_0or1row check_default_price_list {}]} {
+# return $list_id
+# } else {
+# return ""
+# }
}
+# created 2006/08/04 by cognovis/nfl
+ad_proc -public iv::price_list::get_default_list_id {
+ {-package_id ""}
+} {
+ @author Nils Lohse (nils.lohse@cognovis.de)
+ @creation-date 2006-08-04
+
+ Get id of default price list
+} {
+ if {[empty_string_p $package_id]} {
+ set package_id [ad_conn package_id]
+ }
+
+ # --- 1) try to get the parameter DefaultPriceListID out of the .info file
+ set dpl_id [parameter::get -package_id $package_id -parameter DefaultPriceListID]
+ if {$dpl_id != ""} {
+ return $dpl_id
+ } else {
+ # --- 2) get lowest (= oldest) item_id of the pricelists
+ if {[db_0or1row get_oldest_price_list {}]} {
+ parameter::set_value -package_id $package_id -parameter DefaultPriceListID -value $list_id
+ return $list_id
+ } else {
+ return ""
+ }
+ }
+}
+
+
ad_proc -public iv::price_list::get_price {
-organization_id:required
-category_id:required
@@ -131,3 +172,16 @@
return [db_string get_price "select amount from iv_prices p, cr_items i where i.latest_revision = p.price_id and p.list_id = :list_id and category_id = :category_id" -default ""]
}
}
+
+# created 2006/08/04 by cognovis/nfl
+ad_proc -public iv::price_list::get_name_of_list {
+ -item_id:required
+} {
+ @author Nils Lohse (nils.lohse@cognovis.de)
+ @creation-date 2006-08-04
+
+ Get name of given price list
+} {
+ set pricelist_name [content::item::get_title -item_id $item_id]
+ return $pricelist_name
+}
\ No newline at end of file
Index: openacs-4/packages/invoices/tcl/price-list-procs.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/tcl/price-list-procs.xql,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/invoices/tcl/price-list-procs.xql 14 Dec 2005 22:06:38 -0000 1.2
+++ openacs-4/packages/invoices/tcl/price-list-procs.xql 4 Aug 2006 15:43:42 -0000 1.3
@@ -64,4 +64,16 @@
+
+
+
+ select min(li.item_id) as list_id
+ from acs_objects o, iv_price_lists l, cr_items li
+ where o.object_id = l.list_id
+ and o.package_id = :package_id
+ and l.list_id = li.latest_revision
+
+
+
+
Index: openacs-4/packages/invoices/www/price-list-list.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/price-list-list.adp,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/invoices/www/price-list-list.adp 16 Aug 2005 20:04:34 -0000 1.1
+++ openacs-4/packages/invoices/www/price-list-list.adp 4 Aug 2006 15:43:41 -0000 1.2
@@ -3,4 +3,3 @@
@context;noquote@
-
Index: openacs-4/packages/invoices/www/price-list-list.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/price-list-list.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/invoices/www/price-list-list.tcl 16 Aug 2005 20:04:34 -0000 1.1
+++ openacs-4/packages/invoices/www/price-list-list.tcl 4 Aug 2006 15:43:41 -0000 1.2
@@ -16,6 +16,8 @@
set actions [list "[_ invoices.iv_price_list_New]" price-list-ae "[_ invoices.iv_price_list_New2]"]
+set default_list_id [iv::price_list::get_default_list_id]
+
template::list::create \
-name iv_price_list \
-key list_id \
@@ -24,6 +26,7 @@
title {
label {[_ invoices.iv_price_list_1]}
link_url_eval {[export_vars -base "price-list" {list_id}]}
+ display_template {@iv_price_list.title@*}
}
action {
display_template {#invoices.Edit# #invoices.Delete#}
@@ -37,4 +40,3 @@
}
ad_return_template
-