Index: openacs-4/packages/ecommerce/www/admin/customer-service/customer-history.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/admin/customer-service/customer-history.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/ecommerce/www/admin/customer-service/customer-history.tcl 18 Aug 2008 11:07:04 -0000 1.2 +++ openacs-4/packages/ecommerce/www/admin/customer-service/customer-history.tcl 20 Aug 2008 20:34:33 -0000 1.3 @@ -37,133 +37,84 @@ set order_by "interaction_id" } - -append doc_body "[ad_admin_header "Customer History"] - -

Customer History

- -[ad_context_bar [list "../index.tcl" "Ecommerce([ec_system_name])"] [list "index.tcl" "Customer Service"] "History"] -
- -
-[export_form_vars view_interaction_originator view_interaction_type view_interaction_date order_by] - - - - - - - - - - - - -
RepOriginatorTypeDate
- -" - set interaction_originator_list [db_list get_interation_originator_list "select unique interaction_originator from ec_customer_serv_interactions"] - lappend interaction_originator_list "all" - set linked_interaction_originator_list [list] foreach interaction_originator $interaction_originator_list { if { $interaction_originator == $view_interaction_originator } { - lappend linked_interaction_originator_list "$interaction_originator" + lappend linked_interaction_originator_list "$interaction_originator" } else { - lappend linked_interaction_originator_list "$interaction_originator" + lappend linked_interaction_originator_list "$interaction_originator" } } +set interaction_originator_html "\[ [join $linked_interaction_originator_list " | "] \]" -append doc_body "\[ [join $linked_interaction_originator_list " | "] \] - -" - set interaction_type_list [db_list get_interaction_type_list "select picklist_item from ec_picklist_items where picklist_name='interaction_type' order by sort_key"] - lappend interaction_type_list "all" - foreach interaction_type $interaction_type_list { if { $interaction_type == $view_interaction_type } { - lappend linked_interaction_type_list "$interaction_type" + lappend linked_interaction_type_list "$interaction_type" } else { - lappend linked_interaction_type_list "$interaction_type" + lappend linked_interaction_type_list "$interaction_type" } } +set interaction_type_list_html "\[ [join $linked_interaction_type_list " | "] \]" -append doc_body "\[ [join $linked_interaction_type_list " | "] \] - -" - set interaction_date_list [list [list last_24 "last 24 hrs"] [list last_week "last week"] [list last_month "last month"] [list all all]] - set linked_interaction_date_list [list] - foreach interaction_date $interaction_date_list { if {$view_interaction_date == [lindex $interaction_date 0]} { - lappend linked_interaction_date_list "[lindex $interaction_date 1]" + lappend linked_interaction_date_list "[lindex $interaction_date 1]" } else { - lappend linked_interaction_date_list "[lindex $interaction_date 1]" + lappend linked_interaction_date_list "[lindex $interaction_date 1]" } } +set interaction_date_list_html "\[ [join $linked_interaction_date_list " | "] \]" -append doc_body "\[ [join $linked_interaction_date_list " | "] \] - -
- -
-
-" if {$customer_type == "user_identification_id"} { set customer_query_bit "and i.user_identification_id=:customer_id" } else { set customer_query_bit "and i.user_id=:customer_id" } - if { $view_rep == "all" } { set rep_query_bit "" } else { set rep_query_bit "and i.customer_service_rep=:view_rep" } - if { $view_interaction_originator == "all" } { set interaction_originator_query_bit "" } else { set interaction_originator_query_bit "and i.interaction_originator=:view_interaction_originator" } - if { $view_interaction_type == "all" } { set interaction_type_query_bit "" } else { set interaction_type_query_bit "and i.interaction_type=:view_interaction_type" } - if { $view_interaction_date == "last_24" } { #set interaction_date_query_bit "and sysdate-i.interaction_date <= 1" set interaction_date_query_bit [db_map last_24] @@ -179,15 +130,12 @@ set link_beginning "customer-history.tcl?[export_url_vars customer_type customer_id view_rep view_interaction_originator view_interaction_type view_interaction_date]" -set table_header " - - +set table_header " - -" +\n" #set sql "select i.interaction_id, i.customer_service_rep, i.interaction_date, #to_char(i.interaction_date,'YYYY-MM-DD HH24:MI:SS') as full_interaction_date, i.interaction_originator, @@ -203,57 +151,33 @@ #order by $order_by" set sql [db_map get_customer_interaction_detail_sql] - set row_counter 0 - - +set customer_interaction_detail_html "" db_foreach get_customer_interaction_detail $sql { - if { $row_counter == 0 } { - append doc_body $table_header + append customer_interaction_detail_html $table_header } elseif { $row_counter == 20 } { - append doc_body "
Interaction ID
Interaction ID Date Rep Customer OriginatorType
Type
-

- $table_header - " - set row_counter 1 + append customer_interaction_detail_html "
${table_header}" + set row_counter 1 } # even rows are white, odd are grey if { [expr floor($row_counter/2.)] == [expr $row_counter/2.] } { - set bgcolor "white" + set bgcolor "#ffffff" } else { - set bgcolor "ececec" + set bgcolor "#ececec" } - - append doc_body " - - " + append customer_interaction_detail_html "" if { ![empty_string_p $customer_service_rep] } { - append doc_body "" + append customer_interaction_detail_html "" } else { - append doc_body "" + append customer_interaction_detail_html "" } if { ![empty_string_p $customer_user_id] } { - append doc_body "" + append customer_interaction_detail_html "" } else { - append doc_body "" + append customer_interaction_detail_html "" } - append doc_body " - - - " + append customer_interaction_detail_html "\n" incr row_counter } -if { $row_counter != 0 } { - append doc_body "
$interaction_id[ec_formatted_full_date $full_interaction_date]
$interaction_id[ec_formatted_full_date $full_interaction_date]$rep_last_name, $rep_first_names$rep_last_name, $rep_first_names  $customer_last_name, $customer_first_names$customer_last_name, $customer_first_namesunregistered user: $user_identification_idunregistered user: $user_identification_id$interaction_originator$interaction_type
$interaction_originator$interaction_type
" -} else { - append doc_body "

None Found
" -} - -append doc_body " -
-[ad_admin_footer] -" - -doc_return 200 text/html $doc_body