Index: openacs.org-dev/packages/ecommerce/www/address-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs.org-dev/packages/ecommerce/www/address-2.tcl,v diff -u -r1.1.1.1 -r1.1.1.2 --- openacs.org-dev/packages/ecommerce/www/address-2.tcl 9 Jul 2002 17:35:05 -0000 1.1.1.1 +++ openacs.org-dev/packages/ecommerce/www/address-2.tcl 8 Oct 2002 15:47:06 -0000 1.1.1.2 @@ -9,7 +9,7 @@ @param zip_code @param phone @param phone_time:optional - @param action + @param referer @author @creation-date @@ -28,7 +28,7 @@ zip_code phone phone_time:optional - action + referer } set possible_exception_list [list [list attn name] [list line1 address] [list city city] [list usps_abbrev state] [list zip_code "zip code"] [list phone "telephone number"]] @@ -44,7 +44,7 @@ if { $exception_count > 0 } { ad_return_complaint $exception_count $exception_text - return + ad_script_abort } # We need them to be logged in @@ -53,7 +53,7 @@ if {$user_id == 0} { set return_url "[ad_conn url]?[export_entire_form_as_url_vars]" ad_returnredirect "/register?[export_url_vars return_url]" - return + ad_script_abort } # Make sure they have an in_basket order unless they are ordering a @@ -66,14 +66,14 @@ from ec_orders where user_session_id = :user_session_id and order_state = 'in_basket'" -default ""] -if { $action != "https://www.7-sisters.com:8443/store/gift-certificate-billing" } { +if { $referer != "gift-certificate-billing" } { if { [empty_string_p $order_id] } { # They probably got here by pushing "Back", so just redirect # them to index.tcl ad_returnredirect index.tcl - return + ad_script_abort } } @@ -86,10 +86,15 @@ update ec_addresses set attn=:attn, line1=:line1, line2=:line2, city=:city, usps_abbrev=:usps_abbrev, zip_code=:zip_code, phone=:phone, phone_time=:phone_time where address_id = :address_id" - db_dml set_shipping_on_order " - update ec_orders - set shipping_address = :address_id - where order_id = :order_id" + + # Update the shipping address of the order + + if {$address_type == "shipping"} { + db_dml set_shipping_on_order " + update ec_orders + set shipping_address = :address_id + where order_id = :order_id" + } } db_release_unused_handles @@ -104,18 +109,19 @@ (address_id, user_id, address_type, attn, line1, line2, city, usps_abbrev, zip_code, country_code, phone, phone_time) values (:address_id, :user_id, 'shipping', :attn, :line1,:line2,:city,:usps_abbrev,:zip_code,'US',:phone,:phone_time)" - db_dml set_shipping_on_order " - update ec_orders - set shipping_address = :address_id - where order_id = :order_id" + + # Update the shipping address of the order + + if {$address_type == "shipping"} { + db_dml set_shipping_on_order " + update ec_orders + set shipping_address = :address_id + where order_id = :order_id" + } } } -set formatted_address [ec_display_as_html [ec_pretty_mailing_address_from_args $line1 $line2 $city $usps_abbrev $zip_code "US" \ - "" $attn $phone $phone_time]] -set hidden_form_vars "" -set form_set [ns_getform] -for {set i 0} {$i < [ns_set size $form_set]} {incr i} { - set [ns_set key $form_set $i] [ns_set value $form_set $i] - append hidden_form_vars "[export_form_vars [ns_set key $form_set $i]]" -} +# Return to the calling page (E.g. checkout, billing, +# giftcertificate-billing). + +rp_internal_redirect $referer