Index: openacs-4/packages/ecommerce/www/admin/orders/track-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/admin/orders/track-postgresql.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/ecommerce/www/admin/orders/track-postgresql.xql 10 Jul 2001 20:33:53 -0000 1.1 +++ openacs-4/packages/ecommerce/www/admin/orders/track-postgresql.xql 1 Jan 2009 15:22:41 -0000 1.2 @@ -6,7 +6,7 @@ -select to_char(shipment_date, 'MMDDYY') as ship_date_for_fedex, to_char(shipment_date, 'MM/DD/YYYY') as pretty_ship_date, carrier, tracking_number +select to_char(shipment_date, 'MMDDYY') as ship_date_for_fedex, to_char(shipment_date, 'MM/DD/YYYY') as pretty_ship_date, carrier, tracking_number, expected_arrival_date, order_id from ec_shipments where shipment_id = :shipment_id Index: openacs-4/packages/ecommerce/www/admin/orders/track-update.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/admin/orders/track-update.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/ecommerce/www/admin/orders/track-update.tcl 1 Jan 2009 15:22:41 -0000 1.1 @@ -0,0 +1,40 @@ +ad_page_contract { + This script updates tracking for one shipment + +} { + order_id:integer,notnull + shipment_id:integer,notnull + expected_arrival_date:optional,array,date + expected_arrival_time:optional,array,time + {carrier ""} + {tracking_number ""} +} + +ad_maybe_redirect_for_registration +set ip_address [ns_conn peeraddr] +set user_id [ad_verify_and_get_user_id] + +if { ![info exists expected_arrival_date(date)] } { + set expected_arrival_date(date) "" +} + +if { ![info exists expected_arrival_time(time)] } { + set expected_arrival_time(time) "" +} + +if { [info exists expected_arrival_time(ampm)] && $expected_arrival_time(ampm) eq "PM" } { + # add 12 hours to time + set expected_arrival_time(hours) [expr { int( $expected_arrival_time(hours) + 12 ) } ] + set expected_arrival_time(time) "$expected_arrival_time(hours):$expected_arrival_time(minutes):$expected_arrival_time(seconds)" +} +set expected_arrival_date_time "$expected_arrival_date(date) $expected_arrival_time(time)" +ns_log Notice "track-update: $expected_arrival_date_time" +db_dml update_shipment_info "update ec_shipments + set expected_arrival_date = :expected_arrival_date_time, + carrier = :carrier, tracking_number= :tracking_number, + last_modified = now(), last_modifying_user = :user_id, modified_ip_address = :ip_address + where shipment_id = :shipment_id and order_id = :order_id" + +ad_returnredirect "track?[export_url_vars shipment_id order_id]" + + Index: openacs-4/packages/ecommerce/www/admin/orders/track.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/admin/orders/track.adp,v diff -u -r1.3 -r1.4 --- openacs-4/packages/ecommerce/www/admin/orders/track.adp 1 Jan 2009 12:37:22 -0000 1.3 +++ openacs-4/packages/ecommerce/www/admin/orders/track.adp 1 Jan 2009 15:22:41 -0000 1.4 @@ -4,12 +4,21 @@

@title@

Overview

+ +
+@export_form_vars_html;noquote@
  • Shipping Date: @pretty_ship_date@
  • -
  • Carrier: @carrier@
  • -
  • Tracking Number: @tracking_number@
  • +
  • Carrier: @carrier_select_html;noquote@
  • +
  • Tracking Number:
  • +
  • Expected Arrival Date: @expected_arrival_html;noquote@
+
+ +
+
+

Information from @carrier_name@

Index: openacs-4/packages/ecommerce/www/admin/orders/track.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/admin/orders/track.tcl,v diff -u -r1.7 -r1.8 --- openacs-4/packages/ecommerce/www/admin/orders/track.tcl 1 Jan 2009 12:37:22 -0000 1.7 +++ openacs-4/packages/ecommerce/www/admin/orders/track.tcl 1 Jan 2009 15:22:41 -0000 1.8 @@ -15,10 +15,30 @@ set title "Track Shipment" set context [list [list index "Orders / Shipments / Refunds"] $title] -db_1row shipment_select "select to_char(shipment_date, 'MMDDYY') as ship_date_for_fedex, to_char(shipment_date, 'MM/DD/YYYY') as pretty_ship_date, carrier, tracking_number +set carrier_list [db_list get_carrier_list " + select distinct carrier + from ec_shipments + where carrier is not null + order by carrier"] + + + +db_1row shipment_select "select to_char(shipment_date, 'MMDDYY') as ship_date_for_fedex, to_char(shipment_date, 'MM/DD/YYYY') as pretty_ship_date, carrier, tracking_number, expected_arrival_date, order_id from ec_shipments where shipment_id = :shipment_id" +set export_form_vars_html [export_form_vars shipment_id order_id] + +set carrier_select_html "" + set carrier_info "" if { $carrier == "FedEx" } { @@ -35,7 +55,7 @@ if { ![info exists status] || $status ne "200" } { # no page info returned, just return error - ns_log Warning "ecommerce/www/admin/orders/track.tcl Unable to retrieve FedEx data for ${tracking_number}. Error is $errmsg" + ns_log Warning "ecommerce/www/admin/orders/track.tcl Unable to retrieve FedEx data for ${tracking_number}. Error is $err" } else { # Received page, Remove links set scan_activity [ecds_get_contents_from_tag {} {} $page_from_fedex] @@ -62,3 +82,13 @@ } set carrier_name [ec_decode $carrier "" "Carrier" $carrier] set carrier_tracking_info [ec_decode $carrier_info "" "Unvailable to retrieve details for this carrier." $carrier_info] +if { ![info exists expected_arrival_date] } { + set expected_arrival_date 0 + set expected_arrival_time "5:00:00 PM" +} else { + regsub {[ ]+} $expected_arrival_date { } expected_arrival_date + set expected_arrival_date_list [split $expected_arrival_date " "] + set expected_arrival_date [lindex $expected_arrival_date_list 0] + set expected_arrival_time [lindex $expected_arrival_date_list 1] +} +set expected_arrival_html "[ad_dateentrywidget expected_arrival_date $expected_arrival_date] [ec_timeentrywidget expected_arrival_time $expected_arrival_time]" \ No newline at end of file