Commit 21821c8c authored by Frank Bergmann's avatar Frank Bergmann

- Fixed conf item CSV import

parent 131ebe88
......@@ -215,6 +215,10 @@ foreach csv_line_fields $values_list_of_lists {
}
incr i
}
if {$ns_write_p} { ns_write "<li>Before conf_item_nr: name=$conf_item_name, code=$conf_item_code, nr=$conf_item_nr</font>\n" }
# -------------------------------------------------------
......@@ -230,10 +234,10 @@ foreach csv_line_fields $values_list_of_lists {
}
# conf_item_nr needs to be there
if {"" == $conf_item_nr} {
if {"" eq $conf_item_nr} {
set conf_item_nr [regsub {[^a-z0-9_]} [string trim [string tolower $conf_item_name]] "_"]
}
if {"" == $conf_item_nr} {
if {"" eq $conf_item_nr} {
if {$ns_write_p} {
ns_write "<li><font color=red>Error: We have found an empty 'Conf_Item Nr' in line $cnt.<br>
Please correct the CSV file. Every conf_item needs to have a unique Conf_Item Nr.</font>\n"
......@@ -303,6 +307,9 @@ foreach csv_line_fields $values_list_of_lists {
}
}
if {$ns_write_p} { ns_write "<li>id=$conf_item_id, parent_id=$conf_item_parent_id, name='$conf_item_name', nr='$conf_item_nr'\n" }
# Create a new conf_item if necessary
if {"" == $conf_item_id} {
if {$ns_write_p} { ns_write "<li>Going to create conf_item: name='$conf_item_name', nr='$conf_item_nr'\n" }
......
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