Commit 0b9d7e5a authored by Frank Bergmann's avatar Frank Bergmann

- CSV Import:

  Now supporting (basic!) import of Conf Items
parent bc995038
...@@ -269,7 +269,7 @@ ad_proc -public im_csv_import_parsers { ...@@ -269,7 +269,7 @@ ad_proc -public im_csv_import_parsers {
Returns the list of available parsers Returns the list of available parsers
} { } {
switch $object_type { switch $object_type {
im_project - im_company - im_risk - im_timesheet_task - im_ticket { im_project - im_company - im_conf_item - im_risk - im_timesheet_task - im_ticket {
set parsers { set parsers {
no_change "No Change" no_change "No Change"
hard_coded "Hard Coded Functionality" hard_coded "Hard Coded Functionality"
...@@ -553,6 +553,41 @@ ad_proc -public im_csv_import_convert_project_parent_nrs { ...@@ -553,6 +553,41 @@ ad_proc -public im_csv_import_convert_project_parent_nrs {
ad_proc -public im_csv_import_convert_conf_item_parent_nrs {
{-parent_id ""}
parent_nrs
} {
Returns {parent_id err}
} {
ns_log Notice "im_csv_import_convert_conf_item_parent_nrs -parent_id $parent_id $parent_nrs"
# Recursion end - just return the parent.
if {"" == $parent_nrs} { return [list $parent_id ""] }
# Lookup the first parent_nr below the current parent_id
set parent_nr [lindex $parent_nrs 0]
set parent_nrs [lrange $parent_nrs 1 end]
set parent_sql "= $parent_id"
if {"" == $parent_id} { set parent_sql "is null" }
set parent_id [db_string pid "
select conf_item_id
from im_conf_items
where conf_item_parent_id $parent_sql and
lower(conf_item_nr) = lower(:parent_nr)
"]
if {"" == $parent_id} {
return [list "" "Didn't find conf_item with conf_item_nr='$conf_item_nr' and parent_id='$parent_id'"]
}
return [im_csv_import_convert_conf_item_parent_nrs -parent_id $parent_id $parent_nrs]
}
# --------------------------------------------------------------------- # ---------------------------------------------------------------------
# #
# --------------------------------------------------------------------- # ---------------------------------------------------------------------
......
...@@ -41,8 +41,10 @@ if { $max_n_bytes && ([file size $tmp_filename] > $max_n_bytes) } { ...@@ -41,8 +41,10 @@ if { $max_n_bytes && ([file size $tmp_filename] > $max_n_bytes) } {
# Choose depending on the object type... # Choose depending on the object type...
if {"" == $return_url} { if {"" == $return_url} {
switch $object_type { switch $object_type {
im_project { set return_url "/intranet/projects/index" }
im_company { set return_url "/intranet/companies/index" } im_company { set return_url "/intranet/companies/index" }
im_conf_item { set return_url "/intranet-helpdesk/index" }
im_project { set return_url "/intranet/projects/index" }
person { set return_url "/intranet/users/index" }
default { set return_url "/intranet" } default { set return_url "/intranet" }
} }
} }
......
...@@ -12,11 +12,12 @@ ...@@ -12,11 +12,12 @@
<td>#intranet-csv-import.Object_Type#</td> <td>#intranet-csv-import.Object_Type#</td>
<td> <td>
<%= [im_select object_type [list \ <%= [im_select object_type [list \
im_project "Project" \
person "User" \
im_company "Company" \ im_company "Company" \
im_conf_item "Configuration Item" \
im_project "Project" \
im_risk "Risk" \ im_risk "Risk" \
im_timesheet_task "Timesheet Task" \ im_timesheet_task "Timesheet Task" \
person "User" \
] $object_type] %> ] $object_type] %>
</td> </td>
......
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