Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
intranet-csv-import
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
project-open
intranet-csv-import
Commits
b39e58a7
Commit
b39e58a7
authored
May 07, 2017
by
Frank Bergmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Improved conf_item import
parent
0598fa6e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
2 deletions
+30
-2
intranet-csv-import-parser-procs.tcl
tcl/intranet-csv-import-parser-procs.tcl
+20
-2
intranet-csv-import-procs.tcl
tcl/intranet-csv-import-procs.tcl
+3
-0
import-im_conf_item.tcl
www/import-im_conf_item.tcl
+7
-0
No files found.
tcl/intranet-csv-import-parser-procs.tcl
View file @
b39e58a7
...
...
@@ -445,9 +445,18 @@ ad_proc -public im_csv_import_parser_project_parent_nrs {
set arg
[
string
tolower
[
string
trim
$arg
]]
set parent_id
""
# Shortcut: Accept the name of a project if it's found
set project_ids
[
db_list project_ids
"select project_id from im_projects where lower(project_name) = :arg"
]
if
{
""
ne
$project
_ids
}
{
if
{
1 eq
[
llength
$project
_ids
]}
{
return
[
list
[
lindex
$project
_ids 0
]
""
]
}
else
{
return
[
list
""
"Found multiple projects with name '
$arg
': Please use a space separated list of project_nrs."
]
}
}
# Loop through the list of parent_nrs
foreach parent_nr
$arg
{
set parent_sql
"parent_id =
$parent
_id"
if
{
""
eq
$parent
_id
}
{
set parent_sql
"parent_id is null"
}
set project_id
[
db_string pid
"select project_id from im_projects where
$parent
_sql and lower(project_nr) = :parent_nr"
-default
""
]
...
...
@@ -469,9 +478,18 @@ ad_proc -public im_csv_import_parser_conf_item_parent_nrs {
set arg
[
string
tolower
[
string
trim
$arg
]]
set parent_id
""
# Shortcut: Accept the name of a conf_item if it's found
set conf_item_ids
[
db_list conf_item_ids
"select conf_item_id from im_conf_items where lower(conf_item_name) = :arg"
]
if
{
""
ne
$conf
_item_ids
}
{
if
{
1 eq
[
llength
$conf
_item_ids
]}
{
return
[
list
[
lindex
$conf
_item_ids 0
]
""
]
}
else
{
return
[
list
""
"Found multiple conf_items with name '
$arg
': Please use a space separated list of conf_item_nrs."
]
}
}
# Loop through the list of parent_nrs
foreach parent_nr
$arg
{
set parent_sql
"conf_item_parent_id =
$parent
_id"
if
{
""
eq
$parent
_id
}
{
set parent_sql
"conf_item_parent_id is null"
}
set project_id
[
db_string pid
"select conf_item_id from im_conf_items where
$parent
_sql and lower(conf_item_nr) = :parent_nr"
-default
""
]
...
...
tcl/intranet-csv-import-procs.tcl
View file @
b39e58a7
...
...
@@ -328,11 +328,14 @@ ad_proc -public im_csv_import_guess_im_conf_item { } {} {
{
conf_item_nr
"Conf Item Nr"
no_change
""
}
{
conf_item_code
"Conf Item Code"
no_change
""
}
{
conf_item_parent_id
"Parent Conf Item Nr"
conf_item_parent_nrs
""
}
{
conf_item_parent_id
"Conf Item Parent Nrs"
conf_item_parent_nrs
""
}
{
conf_item_cost_center_id
"Conf Item Cost Center Code"
cost_center
""
}
{
conf_item_status_id
"Conf Item Status"
category
"Intranet Conf Item Status"
}
{
conf_item_type_id
"Conf Item Type"
category
"Intranet Conf Item Type"
}
{
conf_item_owner_id
"Conf Item Owner"
user_name
""
}
{
conf_item_owner_id
"Conf Item Owner Email"
user_name
""
}
{
conf_item_project_id
"Project"
project_parent_nrs
""
}
{
conf_item_project_id
"Conf Item Project Parent Nrs"
project_parent_nrs
""
}
{
conf_item_version
"Conf Item Version"
no_change
""
}
{
description
"Description"
no_change
""
}
{
note
"Note"
no_change
""
}
...
...
www/import-im_conf_item.tcl
View file @
b39e58a7
...
...
@@ -137,6 +137,7 @@ foreach csv_line_fields $values_list_of_lists {
set conf_item_cost_center_code
""
set conf_item_cost_center_id
""
set conf_item_version
""
set conf_item_project_id
""
set description
""
set note
""
...
...
@@ -369,6 +370,12 @@ foreach csv_line_fields $values_list_of_lists {
set role_id
[
im_biz_object_role_full_member
]
im_biz_object_add_role
$conf
_item_owner_id
$conf
_item_id
$role
_id
}
if
{
""
!=
$conf
_item_project_id
}
{
if
{
$ns
_write_p
}
{
ns_write
"<li>Adding to project #
$conf
_item_project_id.
\n
"
}
im_conf_item_new_project_rel -project_id
$conf
_item_project_id -conf_item_id
$conf
_item_id
}
# -------------------------------------------------------
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment