Index: openacs-4/packages/ecommerce/www/gift-certificate-order-4.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/gift-certificate-order-4.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/ecommerce/www/gift-certificate-order-4.tcl 31 Jan 2002 22:43:54 -0000 1.3 +++ openacs-4/packages/ecommerce/www/gift-certificate-order-4.tcl 26 May 2002 04:36:50 -0000 1.4 @@ -1,11 +1,15 @@ -# www/ecommerce/gift-certificate-order-4.tcl ad_page_contract { - dispays order summary - @author - @creation-date - @cvs-id gift-certificate-order-4.tcl,v 3.2.6.6 2000/08/18 21:46:33 stevenp Exp - @author ported by Jerry Asher (jerry@theashergroup.com) + + Dispays order summary + + @author + @creation-date + @author ported by Jerry Asher (jerry@theashergroup.com) + @author revised by Bart Teeuwisse + @revision-date April 2002 + } { + address_id certificate_to certificate_from certificate_message @@ -15,101 +19,114 @@ creditcard_type creditcard_expire_1 creditcard_expire_2 - billing_zip_code } -# - ec_redirect_to_https_if_possible_and_necessary -# get rid of spaces and dashes +# Get rid of spaces and dashes + regsub -all -- "-" $creditcard_number "" creditcard_number regsub -all " " $creditcard_number "" creditcard_number -# user must be logged in +# User must be logged in + set user_id [ad_verify_and_get_user_id] -# wtem@olywa.net, 2001-03-29 -# user login rolled into ec_redirect_to_https_if_possible_and_necessary +# Error checking -# error checking - set exception_count 0 set exception_text "" if { [string length $certificate_message] > 200 } { incr exception_count - append exception_text "
  • The message you entered was too long. It needs to contain fewer than 200 characters (the current length is [string length $certificate_message] characters)." + append exception_text " +
  • + The message you entered was too long. It needs to contain fewer than 200 characters (the current length is [string length $certificate_message] characters). +
  • " } if { [string length $certificate_to] > 100 } { incr exception_count - append exception_text "
  • What you entered in the \"To\" field is too long. It needs to contain fewer than 100 characters (the current length is [string length $certificate_to] characters)." + append exception_text " +
  • + What you entered in the \"To\" field is too long. It needs to contain fewer than 100 characters (the current length is [string length $certificate_to] characters). +
  • " } if { [string length $certificate_from] > 100 } { incr exception_count - append exception_text "
  • What you entered in the \"From\" field is too long. It needs to contain fewer than 100 characters (the current length is [string length $certificate_from] characters)." + append exception_text " +
  • + What you entered in the \"From\" field is too long. It needs to contain fewer than 100 characters (the current length is [string length $certificate_from] characters). +
  • " } if { [string length $recipient_email] > 100 } { incr exception_count - append exception_text "
  • The recipient email address you entered is too long. It needs to contain fewer than 100 characters (the current length is [string length $recipient_email] characters)." + append exception_text " +
  • + The recipient email address you entered is too long. It needs to contain fewer than 100 characters (the current length is [string length $recipient_email] characters). +
  • " } if { $amount < [ad_parameter -package_id [ec_id] MinGiftCertificateAmount ecommerce] } { incr exception_count - append exception_text "
  • The amount needs to be at least [ec_pretty_price [ad_parameter -package_id [ec_id] MinGiftCertificateAmount ecommerce]]" + append exception_text " +
  • + The amount needs to be at least [ec_pretty_price [ad_parameter -package_id [ec_id] MinGiftCertificateAmount ecommerce]] +
  • " } elseif { $amount > [ad_parameter -package_id [ec_id] MaxGiftCertificateAmount ecommerce] } { incr exception_count - append exception_text "
  • The amount cannot be higher than [ec_pretty_price [ad_parameter -package_id [ec_id] MaxGiftCertificateAmount ecommerce]]" + append exception_text " +
  • + The amount cannot be higher than [ec_pretty_price [ad_parameter -package_id [ec_id] MaxGiftCertificateAmount ecommerce]] +
  • " } -# if { [empty_string_p $recipient_email] } { -# incr exception_count -# append exception_text "
  • You forgot to specify the recipient's email address (we need it so we can send them their gift certificate!)" -# } elseif {![philg_email_valid_p $recipient_email]} { -# incr exception_count -# append exception_text "
  • The recipient's email address that you typed doesn't look right to us. Examples of valid email addresses are -# -# " -# } - if { [regexp {[^0-9]} $creditcard_number] } { + # I've already removed spaces and dashes, so only numbers should remain + incr exception_count - append exception_text "
  • Your credit card number contains invalid characters." + append exception_text " +
  • + Your credit card number contains invalid characters. +
  • " } if { ![info exists creditcard_type] || [empty_string_p $creditcard_type] } { incr exception_count - append exception_text "
  • You forgot to enter your credit card type." + append exception_text " +
  • + You forgot to enter your credit card type. +
  • " } -# make sure the credit card type is right & that it has the right number -# of digits -# set additional_count_and_text [ec_creditcard_precheck $creditcard_number $creditcard_type] +# Make sure the credit card type is right & that it has the right +# number of digits -# set exception_count [expr $exception_count + [lindex $additional_count_and_text 0]] -# append exception_text [lindex $additional_count_and_text 1] +set additional_count_and_text [ec_creditcard_precheck $creditcard_number $creditcard_type] +set exception_count [expr $exception_count + [lindex $additional_count_and_text 0]] +append exception_text [lindex $additional_count_and_text 1] if { ![info exists creditcard_expire_1] || [empty_string_p $creditcard_expire_1] || ![info exists creditcard_expire_2] || [empty_string_p $creditcard_expire_2] } { incr exception_count - append exception_text "
  • Please enter your full credit card expiration date (month and year)" + append exception_text " +
  • + Please enter your full credit card expiration date (month and year) +
  • " } if { $exception_count > 0 } { ad_return_complaint $exception_count $exception_text return } - - set gift_certificate_id [db_nextval ec_gift_cert_id_sequence] -set user_email [db_string get_email_for_user "select email from cc_users where user_id=:user_id"] +set user_email [db_string get_email_for_user " + select email + from cc_users + where user_id=:user_id"] -set hidden_form_variables [export_form_vars certificate_to certificate_from certificate_message amount recipient_email creditcard_number creditcard_type creditcard_expire_1 creditcard_expire_2 billing_zip_code gift_certificate_id] +set hidden_form_variables [export_form_vars address_id certificate_to certificate_from certificate_message amount recipient_email creditcard_number creditcard_type \ + creditcard_expire_1 creditcard_expire_2 billing_address gift_certificate_id] if { ![empty_string_p $certificate_to] } { set to_row "To:$certificate_to" @@ -132,5 +149,3 @@ set formatted_amount [ec_pretty_price $amount] set zero_in_the_correct_currency [ec_pretty_price 0] db_release_unused_handles -ec_return_template -