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
7ada079a
Commit
7ada079a
authored
Sep 29, 2016
by
Frank Bergmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- AEC: Fixed project import:
- project_lead parsing - customer_contact parsing
parent
c693732e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
16 deletions
+19
-16
import-im_project.tcl
www/import-im_project.tcl
+19
-16
No files found.
www/import-im_project.tcl
View file @
7ada079a
...
...
@@ -190,7 +190,7 @@ foreach csv_line_fields $values_list_of_lists {
ns_log notice
"upload-companies-2: varname(
[
lindex
$header
_fields
$j
]
) =
$var
_name"
set var_value
[
string
trim
[
lindex
$csv
_line_fields
$j
]]
set var_value
[
string
map -nocase
{
"
\"
"
"'"
"
\[
"
"("
"
\{
"
"("
"
\}
"
")"
"
\]
"
")"
}
$var
_value
]
set var_value
[
string
map -nocase
{
"
\"
"
"'"
"
\[
"
"("
"
\{
"
"("
"
\}
"
")"
"
\]
"
")"
"
\$
"
""
}
$var
_value
]
if
{
"NULL"
eq
$var
_value
}
{
set var_value
""
}
# replace unicode characters by non-accented characters
...
...
@@ -271,7 +271,7 @@ foreach csv_line_fields $values_list_of_lists {
# parent_nrs contains a space separated list
if
{[
catch
{
set result
[
im_csv_import_
convert
_project_parent_nrs
$parent
_nrs
]
set result
[
im_csv_import_
parser
_project_parent_nrs
$parent
_nrs
]
}
err_msg
]}
{
if
{
$ns
_write_p
}
{
ns_write
"<li><font color=red>Error: We have found an error parsing Parent NRs '
$parent
_nrs'.<pre>
\n
$err
_msg</pre>"
}
continue
...
...
@@ -332,23 +332,26 @@ foreach csv_line_fields $values_list_of_lists {
if
{
""
eq
$project
_lead_id
}
{
if
{
$ns
_write_p
}
{
ns_write
"<li><font color=brown>Warning: No project manager found. Will try to create project w/o PM. </font>
\n
"
}
}
else
{
# Check if project_lead_id contains integer
if
{
!
[
string
is digit
$project
_lead_id
]
}
{
set project_lead_id
[
im_id_from_user_name
$project
_lead_id
]
if
{
""
eq
$project
_lead_id
}
{
ns_write
"<li><font color='red'>Warning: Didn't find a
\]
po
\[
user for: '
$project
_lead_id'.</font>
\n
"
}
}
# Check if project_lead_id can be found in DB
if
{
!
[
db_string sql
"select count(*) from parties where party_id = :project_lead_id"
-default 0
]
}
{
ns_write
"<li><font color='red'>Warning: Didn't find a
\]
po
\[
user for: '
$project
_lead_id'.</font>
\n
"
set project_lead
$project
_lead_id
set project_lead_tuple
[
im_csv_import_parser_user_name
$project
_lead
]
set project_lead_id
[
lindex
$project
_lead_tuple 0
]
set project_lead_error
[
lindex
$project
_lead_tuple 1
]
if
{
""
ne
$project
_lead_error
}
{
if
{
$ns
_write_p
}
{
ns_write
"<li><font color=brown>Warning: Error parsing project_lead '
$project
_lead':<br>
$project
_lead_error.</font>
\n
"
}
}
}
# ToDo: make import 'forgiving' -> see project_lead_id
set customer_contact_id
[
im_id_from_user_name
$customer
_contact
]
if
{
""
==
$customer
_contact_id &&
""
!=
$customer
_contact
}
{
if
{
$ns
_write_p
}
{
ns_write
"<li><font color=brown>Warning: Didn't find customer contact '
$customer
_contact'.</font>
\n
"
}
set customer_contact_id
""
if
{
""
ne
$customer
_contact
}
{
set customer_contact_tuple
[
im_csv_import_parser_user_name
$customer
_contact
]
set customer_contact_id
[
lindex
$customer
_contact_tuple 0
]
set customer_contact_error
[
lindex
$customer
_contact_tuple 1
]
if
{
""
==
$customer
_contact_id &&
""
!=
$customer
_contact
}
{
if
{
$ns
_write_p
}
{
ns_write
"<li><font color=brown>Warning: Didn't find customer contact '
$customer
_contact'.</font>
\n
"
}
}
if
{
""
ne
$customer
_contact_error
}
{
if
{
$ns
_write_p
}
{
ns_write
"<li><font color=brown>Warning: Error parsing customer contact '
$customer
_contact':<br>
$customer
_contact_error.</font>
\n
"
}
}
}
# -------------------------------------------------------
...
...
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