Index: openacs-4/packages/dotlrn-ecommerce/www/home.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/home.tcl,v
diff -u -r1.4 -r1.5
--- openacs-4/packages/dotlrn-ecommerce/www/home.tcl 28 Jul 2005 23:43:43 -0000 1.4
+++ openacs-4/packages/dotlrn-ecommerce/www/home.tcl 4 Aug 2005 23:33:17 -0000 1.5
@@ -86,11 +86,15 @@
set invisible_p [whos_online::user_invisible_p [ad_conn untrusted_user_id]]
db_multirow -extend { order_url } orders get_orders {
- select order_id, confirmed_date
- from ec_orders
- where user_id=:user_id
+ select o.order_id, confirmed_date
+ from ec_orders o, dotlrn_ecommerce_transactions t, ec_items i, dotlrn_ecommerce_section s
+ where o.order_id = t.order_id
+ and o.order_id = i.order_id
+ and i.product_id = s.product_id
+ and user_id=:user_id
and order_state not in ('in_basket','void','expired')
- order by order_id
+ group by o.order_id, confirmed_date
+ order by o.order_id
} {
set order_url [export_vars -base [apm_package_url_from_key ecommerce]order { order_id }]
set confirmed_date [util_AnsiDatetoPrettyDate $confirmed_date]
Index: openacs-4/packages/dotlrn-ecommerce/www/admin/index.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/admin/index.adp,v
diff -u -r1.15 -r1.16
--- openacs-4/packages/dotlrn-ecommerce/www/admin/index.adp 4 Aug 2005 18:48:50 -0000 1.15
+++ openacs-4/packages/dotlrn-ecommerce/www/admin/index.adp 4 Aug 2005 23:33:17 -0000 1.16
@@ -17,7 +17,13 @@
#dotlrn-ecommerce.lt_Manage_Registration_A#
#dotlrn-ecommerce.lt_Waiting_List_and_Prer#
+#dotlrn-ecommerce.View_Orders#
+
+
#dotlrn-ecommerce.Administrative_Setup#
Index: openacs-4/packages/dotlrn-ecommerce/www/admin/one-section.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/admin/one-section.adp,v
diff -u -r1.9 -r1.10
--- openacs-4/packages/dotlrn-ecommerce/www/admin/one-section.adp 1 Aug 2005 00:06:58 -0000 1.9
+++ openacs-4/packages/dotlrn-ecommerce/www/admin/one-section.adp 4 Aug 2005 23:33:17 -0000 1.10
@@ -26,6 +26,7 @@
#dotlrn-ecommerce.List_Registrants#
#dotlrn-ecommerce.Related_Users#
#dotlrn-ecommerce.lt_Waiting_List_and_Prer#
+#dotlrn-ecommerce.Order_Summary#
#dotlrn-ecommerce.Public_Pages#
Index: openacs-4/packages/dotlrn-ecommerce/www/admin/one-user.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/admin/one-user.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-ecommerce/www/admin/one-user.adp 4 Aug 2005 23:33:17 -0000 1.1
@@ -0,0 +1,45 @@
+
+ @page_title@
+ @context;noquote@
+ user_info.first_names
+ @user_id@
+
+
+
+
+
+ #acs-subsite.Basic_Information#
+
+
+
+ |
+
+
+ #dotlrn-ecommerce.Order_History#
+
+
+ #dotlrn-ecommerce.Applications#
+
+
+ |
+
+
\ No newline at end of file
Index: openacs-4/packages/dotlrn-ecommerce/www/admin/one-user.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/admin/one-user.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-ecommerce/www/admin/one-user.tcl 4 Aug 2005 23:33:17 -0000 1.1
@@ -0,0 +1,95 @@
+# /pvt/home.tcl
+
+ad_page_contract {
+ user's workspace page
+ @cvs-id $Id: one-user.tcl,v 1.1 2005/08/04 23:33:17 roelc Exp $
+} {
+ user_id:integer,notnull
+ {cancel ""}
+} -properties {
+ system_name:onevalue
+ context:onevalue
+ full_name:onevalue
+ email:onevalue
+ url:onevalue
+ screen_name:onevalue
+ bio:onevalue
+ portrait_state:onevalue
+ portrait_publish_date:onevalue
+ portrait_title:onevalue
+ export_user_id:onevalue
+ ad_url:onevalue
+ member_link:onevalue
+ pvt_home_url:onevalue
+}
+
+acs_user::get -array user -include_bio -user_id $user_id
+
+set account_status [ad_conn account_status]
+set login_url [ad_get_login_url]
+set subsite_url [ad_conn vhost_subsite_url]
+
+set page_title "[_ dotlrn-ecommerce.User_information_for] [person::name -person_id $user_id]"
+
+set pvt_home_url [ad_pvt_home]
+
+set context [list $page_title]
+
+set ad_url [ad_url]
+
+set return_url [ad_return_url]
+
+db_multirow -extend { order_url } orders get_orders {
+ select o.order_id, confirmed_date
+ from ec_orders o, dotlrn_ecommerce_transactions t, ec_items i, dotlrn_ecommerce_section s
+ where o.order_id = t.order_id
+ and o.order_id = i.order_id
+ and i.product_id = s.product_id
+ and user_id=:user_id
+ and order_state not in ('in_basket','void','expired')
+ group by o.order_id, confirmed_date
+ order by o.order_id
+} {
+ set order_url [export_vars -base ecommerce/one { order_id }]
+ set confirmed_date [util_AnsiDatetoPrettyDate $confirmed_date]
+}
+
+set sessions_with_applications 0
+db_multirow -extend { asm_url edit_asm_url } sessions sessions {
+ select c.community_id, c.pretty_name
+ from dotlrn_member_rels_full r, dotlrn_communities c
+ where r.community_id = c.community_id
+ and r.member_state = 'awaiting payment'
+ and r.user_id = :user_id
+} {
+ if { [db_0or1row assessment {
+ select ss.session_id, c.assessment_id
+
+ from dotlrn_ecommerce_section s,
+ (select c.*
+ from dotlrn_catalogi c,
+ cr_items i
+ where c.course_id = i.live_revision) c,
+ (select a.*
+ from as_assessmentsi a,
+ cr_items i
+ where a.assessment_id = i.latest_revision) a,
+ as_sessions ss
+
+ where s.community_id = :community_id
+ and s.course_id = c.item_id
+ and c.assessment_id = a.item_id
+ and a.assessment_id = ss.assessment_id
+ and ss.subject_id = :user_id
+
+ order by creation_datetime desc
+
+ limit 1
+ }] } {
+ set asm_url [export_vars -base /assessment/session { session_id }]
+ set edit_asm_url [export_vars -base /assessment/assessment { assessment_id }]
+ incr sessions_with_applications
+ }
+}
+
+set catalog_url [ad_conn package_url]
\ No newline at end of file
Index: openacs-4/packages/dotlrn-ecommerce/www/admin/users.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/admin/users.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-ecommerce/www/admin/users.adp 4 Aug 2005 23:33:17 -0000 1.1
@@ -0,0 +1,9 @@
+
+ #dotlrn-ecommerce.List_Users#
+ {#dotlrn-ecommerce.List_Users#}
+
+
+
+
+
+
\ No newline at end of file
Index: openacs-4/packages/dotlrn-ecommerce/www/admin/users.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/admin/users.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-ecommerce/www/admin/users.tcl 4 Aug 2005 23:33:17 -0000 1.1
@@ -0,0 +1,94 @@
+# packages/dotlrn-ecommerce/www/admin/process-purchase.tcl
+
+ad_page_contract {
+
+
+
+ @author Roel Canicula (roelmc@pldtdsl.net)
+ @creation-date 2005-05-19
+ @arch-tag: d78f1eb7-313d-4c1a-8f1c-6be5c4f0765a
+ @cvs-id $Id: users.tcl,v 1.1 2005/08/04 23:33:17 roelc Exp $
+} {
+ {orderby email_address}
+ {page 1}
+ {search:trim ""}
+} -properties {
+} -validate {
+} -errors {
+}
+
+ad_form -name "search" -export { return_url section_id } -form {
+ {search:text {label "Search existing users"}}
+}
+
+if { ! [empty_string_p $search] } {
+
+ set page_query [subst {
+ select u.user_id, u.email, u.first_names, u.last_name, a.phone, a.line1, a.line2
+ from dotlrn_users u
+ left join (select *
+ from ec_addresses
+ where address_id
+ in (select max(address_id)
+ from ec_addresses
+ group by user_id)) a
+ on (u.user_id = a.user_id)
+ where (lower(first_names) like lower(:search)||'%' or
+ lower(last_name) like lower(:search)||'%' or
+ lower(email) like lower(:search)||'%' or
+ lower(phone) like '%'||lower(:search)||'%')
+ }]
+
+ template::list::create \
+ -name "users" \
+ -multirow "users" \
+ -no_data "No users found" \
+ -key user_id \
+ -page_query $page_query \
+ -page_size 50 \
+ -page_flush_p 1 \
+ -elements {
+ user_id {
+ label "User ID"
+ }
+ email {
+ label "Email Address"
+ }
+ first_names {
+ label "First Name"
+ }
+ last_name {
+ label "Last Name"
+ }
+ phone {
+ label "Phone Number"
+ }
+ address {
+ label "Address"
+ display_template {
+ @users.line1@
+
+
@users.line2@
+
+ }
+ }
+ action {
+ html { nowrap }
+ display_template {
+ [_ dotlrn-ecommerce.User_Info]
+ [_ dotlrn-ecommerce.Order_Details]
+ }
+ }
+ } \
+ -filters {
+ search {}
+ return_url {}
+ }
+
+ db_multirow -extend { add_member_url } users users [subst {
+ $page_query
+ [template::list::page_where_clause -name users -key u.user_id -and]
+ }] {
+ set add_member_url [export_vars -base one-user { user_id }]
+ }
+}
\ No newline at end of file
Index: openacs-4/packages/dotlrn-ecommerce/www/admin/ecommerce/index.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/admin/ecommerce/index.adp,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/dotlrn-ecommerce/www/admin/ecommerce/index.adp 3 Aug 2005 22:45:46 -0000 1.1
+++ openacs-4/packages/dotlrn-ecommerce/www/admin/ecommerce/index.adp 4 Aug 2005 23:33:17 -0000 1.2
@@ -1,4 +1,11 @@
- Order Summary
+ #dotlrn-ecommerce.Order_Summary#
+ @context@
-
\ No newline at end of file
+
+
+
+
+
+ #dotlrn-ecommerce.Display_All_Orders#
+
Index: openacs-4/packages/dotlrn-ecommerce/www/admin/ecommerce/index.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/admin/ecommerce/index.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/dotlrn-ecommerce/www/admin/ecommerce/index.tcl 3 Aug 2005 22:45:46 -0000 1.1
+++ openacs-4/packages/dotlrn-ecommerce/www/admin/ecommerce/index.tcl 4 Aug 2005 23:33:17 -0000 1.2
@@ -9,61 +9,165 @@
@arch-tag: 275de49f-3457-4b4a-bef3-b86b79964217
@cvs-id $Id$
} {
-
+ section_id:integer,optional
+ user_id:integer,optional
+ start:optional
+ type:optional
+ payment_method:optional
} -properties {
} -validate {
} -errors {
}
+if { [empty_string_p [set available_payment_methods [parameter::get -parameter PaymentMethods]]] } {
+ lappend available_payment_methods cc
+}
+
+set method_filters [list]
+
+foreach available_payment_method [split $available_payment_methods] {
+ set _payment_method [split $available_payment_method :]
+ if { [llength $_payment_method] == 2 } {
+ set _payment_method [lindex $_payment_method 0]
+ }
+
+ lappend method_filters [list [ad_decode $_payment_method \
+ cc "[_ dotlrn-ecommerce.Credit_Card]" \
+ check "[_ dotlrn-ecommerce.Check]" \
+ internal_account "[_ dotlrn-ecommerce.Internal_Account]" \
+ cash "[_ dotlrn-ecommerce.Cash]" \
+ invoice "[_ dotlrn-ecommerce.Invoice]" \
+ scholarship "[_ dotlrn-ecommerce.Scholarship]" \
+ "[_ dotlrn-ecommerce.Credit_Card]"
+ ] \
+ $_payment_method]
+}
+
template::list::create \
-name "orders" \
-multirow "orders" \
+ -page_flush_p 1 \
+ -no_data "[_ dotlrn-ecommerce.lt_No_orders_for_this_se]" \
-elements {
order_id {
- label "Order ID"
+ label "[_ dotlrn-ecommerce.Order_ID]"
link_url_col order_url
html { align center }
}
- order_state {
- label "Order State"
+ section_name {
+ label "[_ dotlrn-ecommerce.Section_Name]"
+ link_url_col section_url
}
- price_to_display {
- label "Total Amount"
- html { align right }
- }
person__name {
- label "Purchaser"
+ label "[_ dotlrn-ecommerce.Purchaser]"
+ link_url_col person_url
}
method {
- label "Payment Method"
+ label "[_ dotlrn-ecommerce.Payment_Method]"
}
+ price_to_display {
+ label "[_ dotlrn-ecommerce.Total_Amount]"
+ html { align right }
+ display_template {
+ @orders.pretty_total@
+ }
+ aggregate sum
+ aggregate_label "[_ dotlrn-ecommerce.Total_1]:"
+ }
balance {
- label "Balance"
+ label "[_ dotlrn-ecommerce.Balance]"
html { align right }
+ display_template {
+
+ Fully Paid
+
+
+ @orders.pretty_balance@
+
+ }
+ aggregate sum
+ aggregate_label "[_ dotlrn-ecommerce.Total_1]:"
}
+ } -filters {
+ section_id {
+ where_clause { s.section_id = :section_id }
+ }
+ user_id {
+ where_clause { o.user_id = :user_id }
+ }
+ start {
+ label "[_ dotlrn-ecommerce.In_the_last]"
+ values {
+ {"24 hours" "24 hours"}
+ {"7 days" "7 days"}
+ {"Month" "1 month"}
+ }
+ where_clause { o.authorized_date >= current_timestamp - :start::interval }
+ }
+ type {
+ label "[_ dotlrn-ecommerce.Orders_with]"
+ values {
+ {"[_ dotlrn-ecommerce.Outstanding_blance]" balance}
+ }
+ where_clause {
+ (case when t.method = 'invoice' then
+ ec_total_price(o.order_id) - ec_order_gift_cert_amount(o.order_id) -
+ (select coalesce(sum(amount), 0)
+ from dotlrn_ecommerce_transaction_invoice_payments
+ where order_id = o.order_id)
+ else 0 end) > 0
+ }
+ }
+ payment_method {
+ label "[_ dotlrn-ecommerce.Payment_method]"
+ values { $method_filters }
+ where_clause { t.method = :payment_method }
+ }
}
-db_multirow -extend { balance order_url } orders orders {
- select o.order_id, o.confirmed_date, o.order_state, ec_total_price(o.order_id) as price_to_display, o.user_id, u.first_names, u.last_name, count(*) as n_items, person__name(o.user_id), t.method
+db_multirow -extend { order_url section_url pretty_total pretty_balance person_url } orders orders [subst {
+ select o.order_id, o.confirmed_date, o.order_state, ec_total_price(o.order_id) as price_to_display, o.user_id as purchasing_user_id, u.first_names, u.last_name, count(*) as n_items, person__name(o.user_id), t.method, s.section_id as _section_id, s.section_name, s.course_id,
+
+ case when t.method = 'invoice' then
+ ec_total_price(o.order_id) - ec_order_gift_cert_amount(o.order_id) -
+ (select coalesce(sum(amount), 0)
+ from dotlrn_ecommerce_transaction_invoice_payments
+ where order_id = o.order_id)
+ else 0 end as balance
+
from ec_orders o
join ec_items i using (order_id)
- left join cc_users u on (o.user_id=u.user_id)
join dotlrn_ecommerce_transactions t using (order_id)
- group by o.order_id, o.confirmed_date, o.order_state, ec_total_price(o.order_id), o.user_id, u.first_names, u.last_name, o.in_basket_date, t.method
- order by o.in_basket_date desc
-} {
- if { $method == "invoice" } {
- set balance [ec_pretty_price [expr $price_to_display - [db_string invoice_payments_sum {
- select coalesce(sum(amount), 0)
- from dotlrn_ecommerce_transaction_invoice_payments
- where order_id = :order_id
- } -default 0]]]
- } else {
- set balance "Paid in full"
- }
+ join dotlrn_ecommerce_section s on (i.product_id = s.product_id)
+ left join cc_users u on (o.user_id=u.user_id)
+
+ where true
+
+ [template::list::filter_where_clauses -and -name orders]
+
+ group by o.order_id, o.confirmed_date, o.order_state, ec_total_price(o.order_id), o.user_id, u.first_names, u.last_name, o.in_basket_date, t.method, s.section_name, s.section_id, s.course_id, o.authorized_date, balance
+ order by o.in_basket_date desc
+}] {
set order_url [export_vars -base one { order_id }]
- set price_to_display [ec_pretty_price $price_to_display]
- set method [string totitle $method]
+ set pretty_total [ec_pretty_price $price_to_display]
+ set pretty_balance [ec_pretty_price $balance]
+ set method [ad_decode $method \
+ cc "[_ dotlrn-ecommerce.Credit_Card]" \
+ check "[_ dotlrn-ecommerce.Check]" \
+ internal_account "[_ dotlrn-ecommerce.Internal_Account]" \
+ cash "[_ dotlrn-ecommerce.Cash]" \
+ invoice "[_ dotlrn-ecommerce.Invoice]" \
+ scholarship "[_ dotlrn-ecommerce.Scholarship]" \
+ "[_ dotlrn-ecommerce.Credit_Card]"
+ ]
set order_state [string totitle $order_state]
+ set section_url [export_vars -base ../one-section { {section_id $_section_id} }]
+ set person_url [export_vars -base ../one-user { {user_id $purchasing_user_id} }]
+}
+
+if { [info exists section_id] } {
+ set context [list [list [export_vars -base ../one-section { section_id }] [db_string section_name { select section_name from dotlrn_ecommerce_section where section_id = :section_id }]] "[_ dotlrn-ecommerce.Order_Summary]"]
+} else {
+ set context [list "[_ dotlrn-ecommerce.Order_Summary]"]
}
\ No newline at end of file