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
26d139fa
Commit
26d139fa
authored
Mar 09, 2017
by
Frank Bergmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
-- several improvements and extensions
parent
bbb7af66
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
18 deletions
+47
-18
intranet-csv-import-procs.tcl
tcl/intranet-csv-import-procs.tcl
+16
-2
import-im_project.tcl
www/import-im_project.tcl
+29
-15
index.adp
www/index.adp
+2
-1
No files found.
tcl/intranet-csv-import-procs.tcl
View file @
26d139fa
...
...
@@ -7,6 +7,7 @@
ad_library
{
@author frank.bergmann@project-open.com
@autor klaus.hofeditz@project-open.com
}
# ---------------------------------------------------------------------
...
...
@@ -19,6 +20,19 @@ ad_library {
# - Parser arguments (important for im_category type
)
# ---------------------------------------------------------------------
ad_proc -public im_csv_import_guess_rels
{
}
{}
{
set mapping
{
{
object_type_1
"Object Type 1"
no_change
""
}
{
object_name_1
"Object Name 1"
user_name
""
}
{
object_type_2
"Object Type 2"
no_change
""
}
{
object_name_2
"Object Name 2"
project_parent_nrs
""
}
{
role_id
"Role"
category
"Intranet Biz Object Role"
}
{
percentage
"Percentage"
number
""
}
}
return
$mapping
}
ad_proc -public im_csv_import_guess_person
{
}
{}
{
set mapping
{
{
email
"Email"
no_change
""
}
...
...
@@ -198,7 +212,7 @@ ad_proc -public im_csv_import_guess_im_timesheet_task { } {} {
{
note
"Note"
no_change
""
}
{
description
"Description"
no_change
""
}
{
material_id
"Material"
material
""
}
{
uom_id
""
category
"Intranet UoM"
}
{
uom_id
"
Unit of measure
"
category
"Intranet UoM"
}
{
planned_units
"Planned Units"
number
""
}
{
billable_units
"Billable Units"
number
""
}
{
cost_center_id
"Cost Center"
cost_center
""
}
...
...
@@ -298,7 +312,7 @@ ad_proc -public im_csv_import_parsers {
Returns the list of available parsers
}
{
switch
$object
_type
{
im_project - im_company - im_conf_item - im_cost - im_invoice - im_risk - im_timesheet_task - im_ticket - im_hour - person
{
im_project - im_company - im_conf_item - im_cost - im_invoice - im_risk - im_timesheet_task - im_ticket - im_hour - person
- rels
{
set parsers
{
boolean
"Boolean"
category
"Category ID from Category Name"
...
...
www/import-im_project.tcl
View file @
26d139fa
...
...
@@ -245,6 +245,7 @@ foreach csv_line_fields $values_list_of_lists {
# -------------------------------------------------------
# Specific field transformations
# project_name needs to be there
if
{
""
==
$project
_name
}
{
if
{
$ns
_write_p
}
{
...
...
@@ -276,7 +277,7 @@ foreach csv_line_fields $values_list_of_lists {
if
{
$ns
_write_p
}
{
ns_write
"<li><font color=red>Error: <pre>
$err
</pre></font>
\n
"
}
continue
}
# Status is a required field
set project_status_id
[
im_id_from_category
$project
_status
"Intranet Project Status"
]
if
{
""
==
$project
_status_id
}
{
...
...
@@ -291,17 +292,18 @@ foreach csv_line_fields $values_list_of_lists {
set project_type_id
[
im_project_type_other
]
}
# start_date and end_date are required fields
if
{
""
==
$start
_date
}
{
if
{
$ns
_write_p
}
{
ns_write
"<li><font color=brown>Warning: Didn't find project start_date, using today.</font>
\n
"
}
set start_date
[
db_string today
"select now()::date from dual"
]
}
if
{
""
==
$end
_date
}
{
if
{
$ns
_write_p
}
{
ns_write
"<li><font color=brown>Warning: Didn't find project end_date, using today.</font>
\n
"
}
set end_date
[
db_string today
"select now()::date from dual"
]
# start_date and end_date are required fields for projects, not tasks
if
{
$project
_type_id != 100
}
{
if
{
""
==
$start
_date
}
{
if
{
$ns
_write_p
}
{
ns_write
"<li><font color=brown>Warning: Didn't find project start_date, using today.</font>
\n
"
}
set start_date
[
db_string today
"select now()::date from dual"
]
}
if
{
""
==
$end
_date
}
{
if
{
$ns
_write_p
}
{
ns_write
"<li><font color=brown>Warning: Didn't find project end_date, using today.</font>
\n
"
}
set end_date
[
db_string today
"select now()::date from dual"
]
}
}
# On track status can be NULL without problems
set on_track_status_id
[
im_id_from_category
[
list
$on
_track_status
]
"Intranet Project On Track Status"
]
...
...
@@ -317,11 +319,25 @@ foreach csv_line_fields $values_list_of_lists {
set company_id
$company
_id
if
{
""
==
$company
_id
}
{
set company_id
[
im_company_internal
]
if
{
$ns
_write_p
}
{
ns_write
"<li><font color=brown>Warning: Didn't find customer_name='
$customer
_name', using 'internal' customer</font>
\n
"
}
if
{
100 ==
$project
_type_id
}
{
# Get company_id from top_project
set sql
"
select company_id from im_projects where project_id in (
select parent.project_id
from im_projects parent,
im_projects child
where child.project_id = :parent_id and
parent.tree_sortkey = tree_root_key(child.tree_sortkey)
)
"
set company_id
[
db_string get_company_id
$sql
-default 0
]
}
else
{
set company_id
[
im_company_internal
]
if
{
$ns
_write_p
}
{
ns_write
"<li><font color=brown>Warning: Didn't find customer_name='
$customer
_name', using 'internal' customer</font>
\n
"
}
}
}
if
{
""
eq
$project
_lead_id
}
{
if
{
""
eq
$project
_lead_id
&& 100 !=
$project
_type_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
"
}
}
...
...
@@ -526,10 +542,8 @@ foreach csv_line_fields $values_list_of_lists {
where
task_id = :project_id
"
}
# -------------------------------------------------------
# Import DynFields
set project_dynfield_updates
{}
...
...
www/index.adp
View file @
26d139fa
...
...
@@ -21,7 +21,8 @@
im_risk
"
Risk
"
\
im_hour
"
Timesheet
Hour
"
\
im_ticket
"
Ticket
"
\
]
$
object_type
]
%
>
rels
"
Relationships
(
e
.
g
.
Projects
/
Tasks
<
-
>
Members" \
] $object_type] %>
</td>
</tr>
<tr>
...
...
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