ec_email_delayed_credit_denied order_idWhat it does:
Use this to send out the "Delayed Credit Denied" email.Defined in: /web/philip/tcl/ecommerce-email.tcl
Source code:
set db [ns_db gethandle subquery]
set selection [ns_db 1row $db "select u.email, u.user_id from ec_orders, users u where ec_orders.user_id=u.user_id and order_id=$order_id"]
set_variables_after_query
set customer_service_signature [ec_customer_service_signature]
set system_url "[ec_insecure_url]"
# have to get rid of ampersands in above variables because they
# mess up regsubs
regsub -all "&" $customer_service_signature {\\&} customer_service_signature
regsub -all "&" $system_url {\\&} system_url
# Note: template #3 is defined to be the "Delayed Credit Denied" email
set selection [ns_db 1row $db "select subject as email_subject, message as email_body, issue_type_list from ec_email_templates where email_template_id=3"]
set_variables_after_query
# and get rid of ctrl-M's in the body
regsub -all "\r" $email_body "" email_body
regsub -all "customer_service_signature_here" $email_body $customer_service_signature email_body
regsub -all "system_url_here" $email_body $system_url email_body
ns_db dml $db "begin transaction"
# create a customer service issue/interaction/action
set user_identification_and_issue_id [ec_customer_service_simple_issue $db "" "automatic" "email" "[DoubleApos "To: $email\nFrom: [ad_parameter CustomerServiceEmailAddress ecommerce]\nSubject: $email_subject"]" $order_id $issue_type_list $email_body $user_id]
set user_identification_id [lindex $user_identification_and_issue_id 0]
set issue_id [lindex $user_identification_and_issue_id 1]
# add a row to the automatic email log
ns_db dml $db "insert into ec_automatic_email_log
(user_identification_id, email_template_id, order_id, date_sent)
values
($user_identification_id, 3, $order_id, sysdate)
"
ns_db dml $db "end transaction"
set email_from [ec_customer_service_email_address $user_identification_id $issue_id]
ec_sendmail_from_service "$email" "$email_from" "$email_subject" "$email_body"
ns_db releasehandle $db