Index: openacs-4/packages/ecommerce/www/admin/products/upload-vendor-imports-2.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/admin/products/upload-vendor-imports-2.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/ecommerce/www/admin/products/upload-vendor-imports-2.adp 16 Aug 2008 12:46:49 -0000 1.1 @@ -0,0 +1,13 @@ + + @title;noquote@ + @context;noquote@ +

@title@

+ + + @doc_body;noquote@ +

Successfully imported @success_count@ @product_string@ out of @line_count@. + See server log for details. +

+
+

@doc_body;noquote@

+
Index: openacs-4/packages/ecommerce/www/admin/products/upload-vendor-imports-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/admin/products/upload-vendor-imports-2.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/ecommerce/www/admin/products/upload-vendor-imports-2.tcl 14 Aug 2008 11:05:42 -0000 1.1 +++ openacs-4/packages/ecommerce/www/admin/products/upload-vendor-imports-2.tcl 16 Aug 2008 12:46:49 -0000 1.2 @@ -12,55 +12,44 @@ } # We need them to be logged in - ad_require_permission [ad_conn package_id] admin set user_id [ad_get_user_id] set peeraddr [ns_conn peeraddr] - +set serious_errors 0 # Grab package_id as context_id - set context_id [ad_conn package_id] + set title "Import Vendors Products" -doc_body_append "[ad_admin_header $title] -

$title

+set context [list [list index Products] $title] -[ad_context_bar [list "../" "Ecommerce([ec_system_name])"] [list "index.tcl" "Products"] $title] -
-
-" - # Get the name of the transfered data file - set unix_file_name ${csv_file.tmpfile} # Check that the file is readable. - if { ![file readable $unix_file_name] } { - doc_body_append "Cannot read file $unix_file_name" - return + append doc_body "Cannot read file $unix_file_name" + set serious_errors 1 } # Check that vendor abbrev length is > 0 if { [string length $abbrev] == 0 } { - doc_body_append "Vendor abbreviation does not exist." - return + append doc_body "Vendor abbreviation does not exist." + set serious_errors 1 } # Start reading. # use file_type to determine which proc to delimit data set datafilefp [open $unix_file_name] set count 0 -set errors 0 +set errors $serious_errors set success_count 0 # Continue reading the file till the end but stop when an error # occured. - set line_status [ns_getcsv $datafilefp elements] while { $line_status != -1 && !$errors } { - # Create or update the product if all the required fields were # given values. foreach vendor_code $elements { @@ -71,7 +60,6 @@ } else { incr success_count } - } # read next line of data file, depending on file type, or end read loop if error. set line_status [ns_getcsv $datafilefp elements] @@ -83,9 +71,4 @@ set product_string "products" } -doc_body_append "
- -

Successfully imported $success_count $product_string out of [ec_decode $count "0" "0" [expr $count -1]]. -See server log for details. -[ad_admin_footer] -" +set line_count [ec_decode $count "0" "0" [expr $count -1]] Index: openacs-4/packages/ecommerce/www/admin/products/upload-vendor-imports.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/admin/products/upload-vendor-imports.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/ecommerce/www/admin/products/upload-vendor-imports.adp 16 Aug 2008 12:46:49 -0000 1.1 @@ -0,0 +1,19 @@ + + @title;noquote@ + @context;noquote@ +

@title@

+

Upload a data file containing vendor product references into the +database, there should only be one reference per line. The system +will attempt to import referenced products from vendor's website based +on custom code built around ecds_import_product_from_vendor_site.

+
+Data Filename +
+@vendor_choose_widget_html;noquote@ +
+
+ +
+
+ + Index: openacs-4/packages/ecommerce/www/admin/products/upload-vendor-imports.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/admin/products/upload-vendor-imports.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/ecommerce/www/admin/products/upload-vendor-imports.tcl 14 Aug 2008 11:05:42 -0000 1.1 +++ openacs-4/packages/ecommerce/www/admin/products/upload-vendor-imports.tcl 16 Aug 2008 12:46:49 -0000 1.2 @@ -8,33 +8,8 @@ } ad_require_permission [ad_conn package_id] admin + set title "Import Vendors Products" -doc_body_append "[ad_admin_header $title] +set context [list [list index Products] $title] -

$title

- -[ad_context_bar [list "../" "Ecommerce([ec_system_name])"] [list "index.tcl" "Products"] $title] - -
- -
- -
-Data Filename -
-[ecds_vendor_choose_widget] -
-
- -
-
- -Notes: - -

- -This page uploads a data file containing vendor product references into the database, there should only be one reference per line. -" -doc_body_append " -[ad_admin_footer] -" +set vendor_choose_widget_html [ecds_vendor_choose_widget]