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
6b926883
Commit
6b926883
authored
Dec 02, 2015
by
Frank Bergmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
-- dev
parent
f1d57512
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
44 deletions
+4
-44
import-im_membership.tcl
www/import-im_membership.tcl
+4
-44
No files found.
www/import-im_membership.tcl
View file @
6b926883
...
...
@@ -34,7 +34,6 @@ if {!$admin_p} {
ad_script_abort
}
# ---------------------------------------------------------------------
# Check and open the file
# ---------------------------------------------------------------------
...
...
@@ -66,43 +65,6 @@ set header_fields [im_csv_split $header $separator]
set
header_len
[
llength
$header
_fields
]
set
values_list_of_lists
[
im_csv_get_values
$lines
_content
$separator
]
# ------------------------------------------------------------
# Get DynFields
# Determine the list of actually available fields.
set
mapped_vars
[
list
"''"
]
foreach
k
[
array
names map
]
{
lappend mapped_vars
"'
$map
(
$k
)'"
}
set
dynfield_sql
"
select distinct
aa.attribute_name,
aa.object_type,
aa.table_name,
w.parameters,
w.widget as tcl_widget,
substring(w.parameters from 'category_type
\"
(.*)
\"
') as category_type
from im_dynfield_widgets w,
im_dynfield_attributes a,
acs_attributes aa
where a.widget_name = w.widget_name and
a.acs_attribute_id = aa.attribute_id and
aa.object_type in ('im_project', 'im_timesheet_task') and
(also_hard_coded_p is null OR also_hard_coded_p = 'f') and
-- Only overwrite DynFields specified in the mapping
aa.attribute_name in (
[
join
$mapped
_vars
","
]
)
"
set
attribute_names
[
db_list attribute_names
"
select distinct
attribute_name
from (
$dynfield
_sql) t
order by attribute_name
"
]
# ------------------------------------------------------------
# Render Result Header
...
...
@@ -127,9 +89,7 @@ foreach csv_line_fields $values_list_of_lists {
set project_nr
""
set project_path
""
set target_project_id
""
foreach attribute_name
$attribute
_names
{
set
$attribute
_name
""
}
set role_id
""
# -------------------------------------------------------
# Extract variables from the CSV file
...
...
@@ -229,7 +189,7 @@ foreach csv_line_fields $values_list_of_lists {
# -------------------------------------------------------
# Find project_id in target DB
#
ns_write
"<li>Matching projects: <ul>"
# Find target_project_id based on project_nr_path
...
...
@@ -291,7 +251,7 @@ foreach csv_line_fields $values_list_of_lists {
# Check permission
set object_type
[
db_string acs_object_type
"select object_type from acs_objects where object_id=:target_project_id"
]
set perm_cmd
"
${object_type}
_permissions
\$
user_id
\$
ob
ject_id view read write admin"
set perm_cmd
"
${object_type}
_permissions
\$
user_id
\$
target_pro
ject_id view read write admin"
eval
$perm
_cmd
if
{
!$write
}
{
...
...
@@ -309,7 +269,7 @@ foreach csv_line_fields $values_list_of_lists {
im_audit -object_id
$target
_project_id -action
"after_update"
-comment
"After adding members"
if
{
$ns
_write_p
}
{
ns_write
"<li>Going to write audit log.
\n
"
}
im_audit -object_id
$project
_id
im_audit -object_id
$
target
_
project_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