You selected \"Inquired via: [string toupper [string index $interaction_type 0]][string range $interaction_type 1 [expr [string length $interaction_type] -1]]\", but you also filled in something in the \"If Other, specify\" field. This is inconsistent.\n"
+ incr exception_count
+ append exception_text "
You selected \"Inquired via: [string toupper [string index $interaction_type 0]][string range $interaction_type 1 [expr [string length $interaction_type] -1]]\", but you also filled in something in the \"If Other, specify\" field. Please fill in one or the other, not both.
\n"
}
-
if { $exception_count > 0 } {
- ad_return_complaint $exception_count $exception_text
+ ad_return_complaint $exception_count $exception_text
ad_script_abort
}
-
# done error checking
-}
+ }
# Have to generate action_id
@@ -108,238 +101,137 @@
# interaction_id will not be generated until the next page (if it doesn't
# exist) so that I can use the fact of its existence or lack of existence
# to create this page's UI
-
set action_id [db_nextval ec_action_id_sequence]
+set title "One Issue"
+set context [list [list index "Customer Service"] $title]
-
-append doc_body "[ad_admin_header "One Issue"]
-
One Issue
-[ad_context_bar [list "../index.tcl" "Ecommerce([ec_system_name])"] [list "index.tcl" "Customer Service Administration"] "One Issue (part of New Interaction)"]
-
-"
-
if { ![info exists c_user_identification_id] } {
- append doc_body "
-
Customer identification:
-
- Here's what we could determine about the customer given the information you typed
- into the previous form:
-
- "
-
+ set customer_id_html "
Customer identification:
+
Here's what we could determine about the customer given the information you typed
+ into the previous form:
"
set positively_identified_p 0
# see if we can find their city/state from the zip code
-
set location [ec_location_based_on_zip_code $postal_code]
-
if { ![empty_string_p $location] } {
- append doc_body "
They live in $location.
"
+ append customer_id_html "
They live in $location.
"
}
-
# I'll be setting variables d_user_id, d_user_identification_id, d_first_names, etc.,
# based on the user info they typed into the last form. "d" stands for "determined",
# meaning that I determined it, as opposed to it being something that they typed in
# if their email address was filled in, see if they're a registered user
if { ![empty_string_p $email] } {
- set email [string toupper $email]
- if { [db_0or1row get_does_row_exist_p "select first_names as d_first_names, last_name as d_last_name, user_id as d_user_id from cc_users where email =lower(:email) "]==1 } {
-
-
- append doc_body "
This is a registered user of the system: $d_first_names $d_last_name.
- [export_form_vars d_user_id]"
- set positively_identified_p 1
- }
-
+ set email [string toupper $email]
+ if { [db_0or1row get_does_row_exist_p "select first_names as d_first_names, last_name as d_last_name, user_id as d_user_id from cc_users where email =lower(:email) "]==1 } {
+ append customer_id_html "
"
- }
-
- }
- }
-
- # also see if they might be a non-user who
- # has had an interaction before
-
- set already_selected_user_identification_id_list [list]
- if { ![empty_string_p $email] } {
- set sql "select user_identification_id as d_user_identification_id from ec_user_identification where email=lower(:email) and user_id is null"
-
- db_foreach get_user_identification $sql {
-
- append doc_body "
This may be the non-registered person who has had a previous interaction with us: [ec_user_identification_summary $d_user_identification_id "t"] (check here if this is correct).
"
- lappend already_selected_user_identification_id_list $d_user_identification_id
- }
- }
-
- set additional_and_clause ""
- if { [llength $already_selected_user_identification_id_list] > 0 } {
- set additional_and_clause "and user_identification_id not in ([join $already_selected_user_identification_id_list ", "])"
- }
-
- if { ![empty_string_p $first_names] || ![empty_string_p $last_name] } {
- if { ![empty_string_p $first_names] && ![empty_string_p $last_name] } {
- set sql "select user_identification_id as d_user_identification_id from ec_user_identification where upper(first_names)=upper(:first_names) and upper(last_name)=upper(:last_name) and user_id is null $additional_and_clause"
- } elseif { ![empty_string_p $first_names] } {
- set sql "select user_identification_id as d_user_identification_id from ec_user_identification where upper(first_names)=upper(:first_names) and user_id is null $additional_and_clause"
- } elseif { ![empty_string_p $last_name] } {
- set sql "select user_identification_id as d_user_identification_id from ec_user_identification where upper(last_name)=upper(:last_name) and user_id is null $additional_and_clause"
- }
-
- db_foreach get_user_identification_info $sql {
+ # then keep trying to identify them
+ if { ![empty_string_p $first_names] || ![empty_string_p $last_name] } {
+ if { ![empty_string_p $first_names] && ![empty_string_p $last_name] } {
+ set sql "select email, user_id as d_user_id from cc_users where upper(first_names)=upper (:first_names) and upper(last_name)=upper(:last_name)"
+ db_foreach get_user_ids $sql {
+ append customer_id_html "
This may be the registered user $first_names $last_name $email (check here if this is correct).
"
+ }
+ } elseif { ![empty_string_p $first_names] } {
+ set sql "select email, user_id as d_user_id, last_name as d_last_name from cc_users where upper(first_names)=upper(:first_names)"
+ db_foreach get_user_id_and_lname $sql {
+ append customer_id_html "
"
+ }
+ }
+ }
+
+ # also see if they might be a non-user who
+ # has had an interaction before
+ set already_selected_user_identification_id_list [list]
+ if { ![empty_string_p $email] } {
+ set sql "select user_identification_id as d_user_identification_id from ec_user_identification where email=lower(:email) and user_id is null"
+ db_foreach get_user_identification $sql {
+ append customer_id_html "
This may be the non-registered person who has had a previous interaction with us: [ec_user_identification_summary $d_user_identification_id "t"] (check here if this is correct).
"
+ lappend already_selected_user_identification_id_list $d_user_identification_id
+ }
+ }
+
+ set additional_and_clause ""
+ if { [llength $already_selected_user_identification_id_list] > 0 } {
+ set additional_and_clause "and user_identification_id not in ([join $already_selected_user_identification_id_list ", "])"
+ }
+ if { ![empty_string_p $first_names] || ![empty_string_p $last_name] } {
+ if { ![empty_string_p $first_names] && ![empty_string_p $last_name] } {
+ set sql "select user_identification_id as d_user_identification_id from ec_user_identification where upper(first_names)=upper(:first_names) and upper(last_name)=upper(:last_name) and user_id is null $additional_and_clause"
+ } elseif { ![empty_string_p $first_names] } {
+ set sql "select user_identification_id as d_user_identification_id from ec_user_identification where upper(first_names)=upper(:first_names) and user_id is null $additional_and_clause"
+ } elseif { ![empty_string_p $last_name] } {
+ set sql "select user_identification_id as d_user_identification_id from ec_user_identification where upper(last_name)=upper(:last_name) and user_id is null $additional_and_clause"
+ }
+ db_foreach get_user_identification_info $sql {
# need to add a db0or1row select ec_customer_service_issues.user_identification where ec_customer_service_issues.issue_id = ec_cs_issue_type_map.issue_id and ec_customer_service_issues.user_identification = $user_identification *** actually, see if you can add the restriction to the loops query, and check if db_foreach skips if no hits, otherwise have to check for it first.
-# if exists then proceed with this iteration of the loop, otherwise ignore it as a false positive.
+# if exists then proceed with this iteration of the loop, otherwise ignore it as a false positive.
# the other possibility is to identify when the customer_service.issue_id is created, and why the map is not...
- append doc_body "
This may be the non-registered person who has had a previous interaction with us: [ec_user_identification_summary $d_user_identification_id "t"] (check here if this is correct).
"
- lappend already_selected_user_identification_id_list $d_user_identification_id
- }
- }
-
- if { [llength $already_selected_user_identification_id_list] > 0 } {
- set additional_and_clause "and user_identification_id not in ([join $already_selected_user_identification_id_list ", "])"
- }
-
- if { ![empty_string_p $other_id_info] } {
- set sql "select user_identification_id as d_user_identification_id from ec_user_identification where other_id_info like '%[DoubleApos $other_id_info]%' $additional_and_clause"
-
- db_foreach get_user_identification_info $sql {
-
- append doc_body "
This may be the non-registered person who has had a previous interaction with us: [ec_user_identification_summary $d_user_identification_id "t"] (check here if this is correct).
"
- lappend already_selected_user_identification_id_list $d_user_identification_id
- }
-
- }
-
- if { [llength $already_selected_user_identification_id_list] > 0 } {
- set additional_and_clause "and user_identification_id not in ([join $already_selected_user_identification_id_list ", "])"
- }
-
- if { ![empty_string_p $postal_code] } {
- set sql "select user_identification_id as d_user_identification_id from ec_user_identification where postal_code=:postal_code $additional_and_clause"
-
- db_foreach get_user_ids_by_postal_code $sql {
-
- append doc_body "
This may be the non-registered person who has had a previous interaction with us: [ec_user_identification_summary $d_user_identification_id "t"] (check here if this is correct).
This may be the non-registered person who has had a previous interaction with us: [ec_user_identification_summary $d_user_identification_id "t"] (check here if this is correct).
"
+ lappend already_selected_user_identification_id_list $d_user_identification_id
+ }
+ }
+
+ if { [llength $already_selected_user_identification_id_list] > 0 } {
+ set additional_and_clause "and user_identification_id not in ([join $already_selected_user_identification_id_list ", "])"
+ }
+ if { ![empty_string_p $other_id_info] } {
+ set sql "select user_identification_id as d_user_identification_id from ec_user_identification where other_id_info like '%[DoubleApos $other_id_info]%' $additional_and_clause"
+ db_foreach get_user_identification_info $sql {
+ append customer_id_html "
This may be the non-registered person who has had a previous interaction with us: [ec_user_identification_summary $d_user_identification_id "t"] (check here if this is correct).
"
+ lappend already_selected_user_identification_id_list $d_user_identification_id
+ }
+ }
+
+ if { [llength $already_selected_user_identification_id_list] > 0 } {
+ set additional_and_clause "and user_identification_id not in ([join $already_selected_user_identification_id_list ", "])"
+ }
+ if { ![empty_string_p $postal_code] } {
+ set sql "select user_identification_id as d_user_identification_id from ec_user_identification where postal_code=:postal_code $additional_and_clause"
+ db_foreach get_user_ids_by_postal_code $sql {
+ append customer_id_html "
This may be the non-registered person who has had a previous interaction with us: [ec_user_identification_summary $d_user_identification_id "t"] (check here if this is correct).