Index: openacs-4/packages/ecommerce/www/admin/orders/items-void.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/admin/orders/items-void.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/ecommerce/www/admin/orders/items-void.tcl 9 Aug 2008 10:33:13 -0000 1.5 +++ openacs-4/packages/ecommerce/www/admin/orders/items-void.tcl 18 Aug 2008 06:10:00 -0000 1.6 @@ -38,18 +38,11 @@ set item_or_items "Item" } -doc_body_append " - [ad_admin_header "Void $item_or_items"] +set title "Void $item_or_items" +set context [list [list index "Orders / Shipments / Refunds"] $title] -

Void $item_or_items

- - [ad_context_bar [list "../" "Ecommerce([ec_system_name])"] [list "index" "Orders"] [list "one?[export_url_vars order_id]" "One Order"] "$item_or_items"] +set export_form_vars_html [export_form_vars order_id product_id] -
-
-
- [export_form_vars order_id product_id]" - # We have to take care of some cases (hopefully #1, the simplest, will # be most prevalent) different cases get different wording and cases # 1-2 are functionally different than cases 3-4 @@ -62,90 +55,53 @@ # 4. More than one item in this order with this product_id and at # least one non-void item has already shipped +set item_state_done 0 + if { $n_items == 1 } { # Cases 1 & 2 (only differ by a warning message) we assume it's # not void, otherwise they wouldn't have been given the link to # this page - set item_state [db_string item_state_select " select item_state from ec_items where order_id = :order_id and product_id = :product_id"] - if { $item_state == "shipped" || $item_state == "arrived" || $item_state == "received_back" } { - doc_body_append " -

Warning: our records show that this item has already - shipped, which means that the customer has already been charged for this - item. Voiding an item will not cause the customer's credit card to be - refunded (you can only do that by marking it \"received back\").

" - } + set item_state_done [expr { $item_state == "shipped" || $item_state == "arrived" || $item_state == "received_back" } ] - db_foreach order_products_select " - select i.item_id, i.item_state, p.product_name, i.price_name, i.price_charged + set order_products_select_html "" + db_foreach order_products_select "select i.item_id, i.item_state, p.product_name, i.price_name, i.price_charged from ec_items i, ec_products p where i.product_id = p.product_id and i.order_id = :order_id and i.product_id = :product_id" { - doc_body_append " -

Please confirm that you want to void $product_name; $price_name: [ec_pretty_pure_price $price_charged] $item_state

" + append order_products_select_html "

Please confirm that you want to void $product_name; $price_name: [ec_pretty_pure_price $price_charged] $item_state

" } + } else { # Cases 3 & 4 (only differ by a warning message) - - set n_shipped_items [db_string num_shipped_items_select " - select count(*) + set n_shipped_items [db_string num_shipped_items_select "select count(*) from ec_items where order_id = :order_id and product_id=:product_id and item_state in ('shipped','arrived','received_back')"] - if { $n_shipped_items > 0 } { - doc_body_append " -

Warning: our records show that at least one of these - items has already shipped, which means that the customer has already - been charged (for shipped items only). Voiding an item will not cause - the customer's credit card to be refunded - (you can only do that by marking it \"received back\").

" - } - doc_body_append " -

Please check off the item(s) you wish to void.

- - - - - " - - db_foreach order_products_select " - select i.item_id, i.item_state, p.product_name, i.price_name, i.price_charged + set order_products_select_html "" + db_foreach order_products_select "select i.item_id, i.item_state, p.product_name, i.price_name, i.price_charged from ec_items i, ec_products p where i.product_id = p.product_id and i.order_id = :order_id and i.product_id = :product_id" { - doc_body_append " - - - - " - } - doc_body_append "
Void ItemProductItem State
" - if { $item_state == "void" } { - doc_body_append " (already void) " - } else { - doc_body_append "" - } - doc_body_append " - $product_name; $price_name: [ec_pretty_pure_price $price_charged]$item_state
" + append order_products_select_html "" + if { $item_state == "void" } { + append order_products_select_html " (already void) " + } else { + append order_products_select_html "" + } + append order_products_select_html "$product_name; $price_name: [ec_pretty_pure_price $price_charged]$item_state" + } } - -doc_body_append " -
-
- -
- - [ad_admin_footer]"