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
b8aa3e22
Commit
b8aa3e22
authored
Mar 15, 2016
by
Frank Bergmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- CSV-Import:
Added some additional hard-coded mappings for im_project
parent
f9ff83f0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
59 deletions
+38
-59
intranet-csv-import-procs.tcl
tcl/intranet-csv-import-procs.tcl
+35
-24
import-2.adp
www/import-2.adp
+0
-34
import-2.tcl
www/import-2.tcl
+3
-1
No files found.
tcl/intranet-csv-import-procs.tcl
View file @
b8aa3e22
...
...
@@ -9,6 +9,39 @@ ad_library {
@author frank.bergmann@project-open.com
}
# ---------------------------------------------------------------------
# Default mapping for built-in
]
po
[
object types
# ---------------------------------------------------------------------
ad_proc -public im_csv_import_guess_im_risk
{
}
{}
{
set mapping
{
{
risk_name
"Risk Name"
no_change
""
}
{
risk_project_id
"Project"
project_nr
""
}
{
risk_status_id
"Status"
category
"Intranet Risk Status"
}
{
risk_type_id
"Type"
category
"Intranet Risk Type"
}
{
risk_description
"Description"
no_change
""
}
{
risk_impact
"Impact"
number_european
""
}
{
risk_probability_percent
"Probability"
number_european
""
}
}
return
$mapping
}
ad_proc -public im_csv_import_guess_im_project
{
}
{}
{
set mapping
{
{
parent_nrs
"Parent Nrs"
hard_coded
""
}
{
company_id
"Customer Name"
hard_coded
""
}
{
start_date
"Start Date"
no_change
""
}
{
end_date
"End Date"
no_change
""
}
{
percent_completed
"Percent Completed"
number_european
""
}
{
project_budget
"Budget"
number_european
""
}
{
project_budget_hours
"Budget Hours"
number_european
""
}
}
return
$mapping
}
# ---------------------------------------------------------------------
# Aux functions
# ---------------------------------------------------------------------
...
...
@@ -358,7 +391,6 @@ ad_proc -public im_csv_import_parsers {
user_name
"User ID from user-email"
}
}
im_membership
{
set parsers
{
no_change
"No Change"
...
...
@@ -368,9 +400,6 @@ ad_proc -public im_csv_import_parsers {
user_name
"User ID from user-email"
}
}
default
{
ad_return_complaint 1
"im_csv_import_parsers: Unknown object type '
$object
_type'"
ad_script_abort
...
...
@@ -412,7 +441,7 @@ ad_proc -public im_csv_import_guess_parser {
set parser
[
lindex
$tuple
2
]
set parser_args
[
lindex
$tuple
3
]
if
{
$field
_name_lower ==
[
string
tolower
$pretty
_name
]}
{
ns_log Notice
"im_csv_import_guess_
map
: found statically encoded match with field_name=
$field
_name"
ns_log Notice
"im_csv_import_guess_
parser
: found statically encoded match with field_name=
$field
_name"
return
[
list
$parser
$parser
_args
$attribute
_name
]
}
}
...
...
@@ -423,7 +452,7 @@ ad_proc -public im_csv_import_guess_parser {
switch
$object
_type
{
im_project - im_timesheet_task - im_ticket
{
switch
$field
_name
{
parent_nrs
{
return
[
list
"hard_coded"
""
""
]
}
parent_nrs
{
return
[
list
"hard_coded"
""
"
parent_id
"
]
}
customer_name
{
return
[
list
"hard_coded"
""
"company_id"
]
}
project_status
{
return
[
list
"hard_coded"
""
"project_status_id"
]
}
on_track_status
{
return
[
list
"hard_coded"
""
"on_track_status_id"
]
}
...
...
@@ -445,7 +474,6 @@ ad_proc -public im_csv_import_guess_parser {
#
# Abort if there are not enough values
if
{[
llength
$sample
_values
]
>= 1
}
{
set date_european_p 1
set date_american_p 1
set number_plain_p 1
...
...
@@ -591,23 +619,6 @@ ad_proc -public im_csv_import_guess_map {
}
# ---------------------------------------------------------------------
# Default mapping for built-in
]
po
[
reports
# ---------------------------------------------------------------------
ad_proc -public im_csv_import_guess_im_risk
{
}
{}
{
set mapping
{
{
risk_name
"Risk Name"
no_change
""
}
{
risk_project_id
"Project"
project_nr
""
}
{
risk_status_id
"Status"
category
"Intranet Risk Status"
}
{
risk_type_id
"Type"
category
"Intranet Risk Type"
}
{
risk_description
"Description"
no_change
""
}
{
risk_impact
"Impact"
number_european
""
}
{
risk_probability_percent
"Probability"
number_european
""
}
}
return
$mapping
}
# ---------------------------------------------------------------------
# Convert the list of parent_nrs into the parent_id
# ---------------------------------------------------------------------
...
...
www/import-2.adp
View file @
b8aa3e22
...
...
@@ -66,39 +66,5 @@
<td><input type="submit" value="<%= [lang::message::lookup "" intranet-csv-import.Import_CSV "Import CSV"] %>"></td>
</tr>
</table>
<p>
<!--
The mapping showing up on this page will be saved as-you-type to simplify the import process.<br/>
This allows you to go back, reload the file without loosing your mapping settings.<br/>
To erase the saved values, please click <span id="forms_delete_save_button" style="text-decoration:underline;cursor:pointer" >here</span>.
--
</p>
</form>
<script type="text/javascript">
$(document).ready(function() {
// Initialize
// $('#@form_id@').sayt({'days': 180});
// if($('#@form_id@').sayt({'checksaveexists': true}) == true)
// { console.log('Form has an existing save cookie.'); } else { console.log('No cookie found'); };
// Do not save the hidden fields
// $('#@form_id@').sayt({'exclude':
// [
// '[name=return_url]',
// '[name=object_type]',
// '[name=import_filename]'
// ]
// });
// $('#forms_delete_save_button').click(function() {
// $('#@form_id@').sayt({'erase': true});
// console.log('Form cookie was deleted.');
// alert('Saved settings have been deleted');
// return false;
// });
});
</script>
www/import-2.tcl
View file @
b8aa3e22
...
...
@@ -209,7 +209,9 @@ foreach header_name $headers {
if
{
"hard_coded"
==
$default
_parser
}
{
set map
[
im_select map.$cnt
$object
_type_pairs
"hard_coded"
]
}
multirow append mapping
$header
_name
$column
$map
$parser
$args
[
lindex
$row
_1
$cnt
]
[
lindex
$row
_2
$cnt
]
[
lindex
$row
_3
$cnt
]
[
lindex
$row
_4
$cnt
]
[
lindex
$row
_5
$cnt
]
# ad_return_complaint 1 "'$column'"
multirow append mapping
$header
_name
$column
$map
$parser
$args
\
[
lindex
$row
_1
$cnt
]
[
lindex
$row
_2
$cnt
]
[
lindex
$row
_3
$cnt
]
[
lindex
$row
_4
$cnt
]
[
lindex
$row
_5
$cnt
]
incr cnt
}
...
...
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