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