Commit 3995cf12 authored by Frank Bergmann's avatar Frank Bergmann

- CSV Import:

  Added return_url logic for undefined return_url
parent d433e0ea
......@@ -271,7 +271,7 @@ ad_proc -public im_csv_import_guess_parser {
# Date parsers
#
# Abort if there are not enough values
if {[llength $sample_values] > 1} {
if {[llength $sample_values] >= 1} {
set date_european_p 1
set date_american_p 1
......
......@@ -35,6 +35,18 @@ if { $max_n_bytes && ([file size $tmp_filename] > $max_n_bytes) } {
ad_script_abort
}
# Empty return_url?
# Choose depending on the object type...
if {"" == $return_url} {
switch $object_type {
im_project { set return_url "/intranet/projects/index" }
im_company { set return_url "/intranet/companies/index" }
default { set return_url "/intranet" }
}
}
# strip off the C:\directories... crud and just get the file name
if ![regexp {([^//\\]+)$} $upload_file match filename] {
# couldn't find a match
......
......@@ -290,6 +290,9 @@ foreach csv_line_fields $values_list_of_lists {
if {"" == $customer_id } {
set customer_id [db_string cust "select company_id from im_companies where lower(company_path) = trim(lower(:customer_name))" -default ""]
}
# For compatibility
set company_id $customer_id
if {"" == $customer_id } {
if {$ns_write_p} {
ns_write "<li><font color=red>Error: Didn't find customer for '$customer_name'.<br>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment