Index: openacs-4/packages/ecommerce/www/address.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/address.tcl,v diff -u -r1.7 -r1.8 --- openacs-4/packages/ecommerce/www/address.tcl 10 Dec 2002 20:06:18 -0000 1.7 +++ openacs-4/packages/ecommerce/www/address.tcl 8 Mar 2004 19:46:11 -0000 1.8 @@ -4,9 +4,11 @@ @param address_id:optional @param referer + @author + @creation-date @author ported by Jerry Asher (jerry@theashergroup.com) @author revised by Bart Teeuwisse (bart.teeuwisse@thecodemill.biz) - @creation-date revised April 2002 + @revision-date April 2002 } { address_type @@ -34,6 +36,16 @@ from ec_addresses where address_id=:address_id" + if {[info exists attn]} { + # delimiter is triple space (for parsing). + set name_delim [string first " " $attn] + if {$name_delim < 0 } { + set name_delim 0 + } + set first_names [string trim [string range $attn 0 $name_delim]] + set last_name [string range $attn [expr $name_delim + 3 ] end] + } + # Redirect to the international address form if the address is # outside the United States. @@ -49,10 +61,22 @@ # Retrieve the default name. + # get the separate fields for card processing + db_0or1row get_names " + select first_names, last_name + from cc_users + where user_id=:user_id" + # we could use a single name field for shipping + # but shipping address becomes default for billing! + # attn has a 3 space delimiter for parsing last/first names + + # set attn just in case it gets used + # avoid using it for single field name entry. + set attn [db_string get_full_name " - select first_names || ' ' || last_name as name - from cc_users - where user_id=:user_id"] + select first_names || ' ' || last_name as name + from cc_users + where user_id=:user_id"] } if { ![info exists state_widget] } { @@ -82,6 +106,20 @@ append hidden_form_vars "[export_form_vars [ns_set key $form_set $i]]" } +if {[info exists last_name] != 1} { + if {[info exists attn]} { + # delimiter is triple space (for parsing). + set name_delim [string first " " $attn] + if {$name_delim < 0 } { + set name_delim 0 + } + set first_names [string trim [string range $attn 0 $name_delim]] + set last_name [string range $attn [expr $name_delim + 3 ] end] + } +} +set user_last_name_with_quotes_escaped [ad_quotehtml $last_name] +set user_first_names_with_quotes_escaped [ad_quotehtml $first_names] + set user_name_with_quotes_escaped [ad_quotehtml $attn] set context_bar [template::adp_parse [acs_root_dir]/packages/[ad_conn package_key]/www/contextbar [list context_addition [list "Completing Your Order"]]] set ec_system_owner [ec_system_owner]