Index: openacs-4/packages/ecommerce/www/admin/orders/gift-certificate.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/admin/orders/gift-certificate.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/ecommerce/www/admin/orders/gift-certificate.tcl 9 Aug 2008 10:33:13 -0000 1.4 +++ openacs-4/packages/ecommerce/www/admin/orders/gift-certificate.tcl 18 Aug 2008 10:45:37 -0000 1.5 @@ -13,65 +13,41 @@ ad_require_permission [ad_conn package_id] admin -doc_body_append "[ad_admin_header "One Gift Certificate"] +set title "One Gift Certificate" +set context [list [list index "Orders / Shipments / Refunds"] $title] -
-" - - - - - -if {![db_0or1row gift_certificate_select " +set found_p [db_0or1row gift_certificate_select " select c.*, i.first_names || ' ' || i.last_name as issuer, i.user_id as issuer_user_id, p.first_names || ' ' || p.last_name as purchaser, p.user_id as purchaser_user_id, gift_certificate_amount_left(c.gift_certificate_id) as amount_left, decode(sign(sysdate-expires),1,'t',0,'t','f') as expired_p, v.first_names as voided_by_first_names, v.last_name as voided_by_last_name, o.first_names || ' ' || o.last_name as owned_by from ec_gift_certificates c, cc_users i, cc_users p, cc_users v, cc_users o where c.issued_by=i.user_id(+) and c.purchased_by=p.user_id(+) and c.voided_by=v.user_id(+) and c.user_id=o.user_id(+) and c.gift_certificate_id=:gift_certificate_id -"]} { - doc_body_append "Not Found. [ad_admin_footer]" - return -} +"] -doc_body_append " --[ad_admin_footer] -"-
" - -if { $expired_p == "f" && $amount_left > 0 && $gift_certificate_state != "void"} { - doc_body_append "(void this) - " -} - -doc_body_append "- Gift Certificate ID $gift_certificate_id -" -if { ![empty_string_p $issuer_user_id] } { - doc_body_append " Amount Left [ec_pretty_pure_price $amount_left] (out of [ec_pretty_pure_price $amount]) +if { $found_p } { +set doc_body "" + if { ![empty_string_p $issuer_user_id] } { + append doc_body " Issued By $issuer on [util_AnsiDatetoPrettyDate $issue_date] Issued By $issuer on [util_AnsiDatetoPrettyDate $issue_date] Issued To $owned_by " -} else { - doc_body_append " - Purchased By $purchaser on [util_AnsiDatetoPrettyDate $issue_date] - " + } else { + append doc_body " Sent To $recipient_email + Purchased By $purchaser on [util_AnsiDatetoPrettyDate $issue_date] " - if { ![empty_string_p $user_id] } { - doc_body_append " Sent To $recipient_email " + if { ![empty_string_p $user_id] } { + append doc_body " Claimed By $owned_by on [util_AnsiDatetoPrettyDate $claimed_date] " + } + } + append doc_body " Claimed By $owned_by on [util_AnsiDatetoPrettyDate $claimed_date] " -} -doc_body_append " [ec_decode $expired_p "t" "Expired" "Expires"] [ec_decode $expires "" "never" [util_AnsiDatetoPrettyDate $expires]] -" + if { $gift_certificate_state == "void" } { + append doc_body " [ec_decode $expired_p "t" "Expired" "Expires"] [ec_decode $expires "" "never" [util_AnsiDatetoPrettyDate $expires]] " + } -if { $gift_certificate_state == "void" } { - doc_body_append " Voided [util_AnsiDatetoPrettyDate $voided_date] by $voided_by_first_names $voided_by_last_name because: $reason_for_void " + if { $expired_p == "f" && $amount_left > 0 && $gift_certificate_state != "void"} { + append doc_body " Voided [util_AnsiDatetoPrettyDate $voided_date] by $voided_by_first_names $voided_by_last_name because: $reason_for_void " + } } -doc_body_append " (void this)