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
be3ac469
Commit
be3ac469
authored
Apr 10, 2012
by
Frank Bergmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- CSV Import:
Now avoiding duplicate attributes
parent
edb0ecd7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
3 deletions
+22
-3
import-im_project.tcl
www/import-im_project.tcl
+22
-3
No files found.
www/import-im_project.tcl
View file @
be3ac469
...
...
@@ -74,6 +74,7 @@ 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
...
...
@@ -509,14 +510,31 @@ foreach csv_line_fields $values_list_of_lists {
# Import DynFields
set project_dynfield_updates
{}
set task_dynfield_updates
{}
array set attributes_hash
{}
db_foreach store_dynfiels
$dynfield
_sql
{
switch
$object
_type
{
im_project
{
ns_log Notice
"import-im_project: name=
$attribute
_name, otype=
$object
_type, table=
$table
_name"
# Avoid storing attributes multipe times into the same table.
# Sub-types can have the same attribute defined as the main type, so duplicate
# DynField attributes are OK.
set key
"
$attribute
_name-
$table
_name"
if
{[
info
exists attributes_hash
(
$key
)]}
{
ns_log Notice
"import-im_project: name=
$attribute
_name already exists."
continue
}
set attributes_hash
(
$key
)
$table
_name
switch
$table
_name
{
im_projects
{
lappend project_dynfield_updates
"
$attribute
_name = :
$attribute
_name"
}
im_timesheet_task
{
im_timesheet_task
s
{
lappend task_dynfield_updates
"
$attribute
_name = :
$attribute
_name"
}
default
{
ad_return_complaint 1
"<b>Dynfield Configuration Error</b>:<br>
Attribute='
$attribute
_name' in table='
$table
_name' is not in im_projects or im_timesheet_tasks."
}
}
}
...
...
@@ -549,6 +567,7 @@ foreach csv_line_fields $values_list_of_lists {
}
break
}
...
...
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