Index: openacs-4/packages/dotlrn-ecommerce/www/ecommerce/checkout-one-form-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/ecommerce/checkout-one-form-2.tcl,v diff -u -r1.12 -r1.13 --- openacs-4/packages/dotlrn-ecommerce/www/ecommerce/checkout-one-form-2.tcl 10 Aug 2005 21:17:47 -0000 1.12 +++ openacs-4/packages/dotlrn-ecommerce/www/ecommerce/checkout-one-form-2.tcl 12 Aug 2005 10:09:32 -0000 1.13 @@ -105,7 +105,7 @@ {method cc} internal_account:optional - {scholarship_p 0} + {scholarship_covers_order_p 0} } # We need them to be logged in @@ -293,6 +293,12 @@ # ec_orders does not track billing address directly, so won't insert an address_id to it. } +if { $method == "scholarship" && $scholarship_covers_order_p == 0 } { + # Go to page where one can select scholarships to purchase from + ad_returnredirect [export_vars -base checkout-scholarships { user_id {return_url [ad_return_url]} }] + ad_script_abort +} + set billing_address_id $address_id # Check if the order requires shipping @@ -876,6 +882,30 @@ } } } +} else { + # If gift certificates cover the cost, assume the user has been + # given a scholarship, in the future we may need to differentiate + # between scholarship grants and normal gift certificates that can + # be purchased separately + if { [db_0or1row check_transaction { + select 1 + from dotlrn_ecommerce_transactions + where order_id = :order_id + }] } { + db_dml update_transaction_check { + update dotlrn_ecommerce_transactions + set method = 'scholarship', + internal_account = null + where order_id = :order_id + } + } else { + db_dml save_transaction_check { + insert into dotlrn_ecommerce_transactions + (order_id, method) + values + (:order_id, 'scholarship') + } + } } # Everything is ok now; the user has a non-empty in_basket order and Index: openacs-4/packages/dotlrn-ecommerce/www/ecommerce/checkout-one-form.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/ecommerce/checkout-one-form.tcl,v diff -u -r1.20 -r1.21 --- openacs-4/packages/dotlrn-ecommerce/www/ecommerce/checkout-one-form.tcl 10 Aug 2005 21:17:47 -0000 1.20 +++ openacs-4/packages/dotlrn-ecommerce/www/ecommerce/checkout-one-form.tcl 12 Aug 2005 10:09:32 -0000 1.21 @@ -699,11 +699,11 @@ regsub -nocase checkout-one-form $submit_url checkout-one-form-2 submit_url - if { $method == "scholarship" } { - # Go to page where one can select scholarships to purchase from - ad_returnredirect [export_vars -base checkout-scholarships { user_id {return_url $submit_url} }] - ad_script_abort - } +# if { $method == "scholarship" } { +# # Go to page where one can select scholarships to purchase from +# ad_returnredirect [export_vars -base checkout-scholarships { user_id {return_url $submit_url} }] +# ad_script_abort +# } ad_returnredirect $submit_url ad_script_abort Index: openacs-4/packages/dotlrn-ecommerce/www/ecommerce/checkout-scholarships-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/ecommerce/checkout-scholarships-2.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn-ecommerce/www/ecommerce/checkout-scholarships-2.tcl 5 Aug 2005 05:40:09 -0000 1.2 +++ openacs-4/packages/dotlrn-ecommerce/www/ecommerce/checkout-scholarships-2.tcl 12 Aug 2005 10:09:32 -0000 1.3 @@ -120,7 +120,7 @@ if { $total_amount >= $order_total_price_pre_gift_certificate } { # Scholarship covers order - set next_url $return_url + set next_url [export_vars -base $return_url { {scholarship_covers_order_p 1} }] } else { set next_url [export_vars -base checkout-one-form { user_id }] }