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
71a5facd
Commit
71a5facd
authored
Oct 27, 2011
by
Frank Bergmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- CSV Import:
Added support for cost centers
parent
58789ba8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
0 deletions
+30
-0
intranet-csv-import-procs.tcl
tcl/intranet-csv-import-procs.tcl
+30
-0
No files found.
tcl/intranet-csv-import-procs.tcl
View file @
71a5facd
...
...
@@ -80,6 +80,32 @@ ad_proc -public im_csv_import_parser_category {
}
}
ad_proc -public im_csv_import_parser_cost_center
{
{
-parser_args
""
}
arg
}
{
Parses a cost center into a cost_center_id
}
{
# Empty input - empty output
if
{
""
==
$arg
}
{
return
[
list
""
""
]
}
# Parse the category
set arg
[
string
trim
[
string
tolower
$arg
]]
set ccids
[
db_list ccid1
"
select cost_center_id
from im_cost_centers
where lower(cost_center_code) = :arg OR
lower(cost_center_label) = :arg OR
lower(cost_center_name) = :arg order by cost_center_id
"
]
set result
[
lindex
$ccids
0
]
if
{
""
==
$result
}
{
return
[
list
""
"Cost Center parser: We did not find any cost center with label, code or name matching the value='
$arg
'."
]
}
else
{
return
[
list
$result
""
]
}
}
# ----------------------------------------------------------------------
#
# ----------------------------------------------------------------------
...
...
@@ -189,6 +215,7 @@ ad_proc -public im_csv_import_parsers {
date_european
"European Date Parser (DD.MM.YYYY)"
date_american
"American Date Parser (MM/DD/YYYY)"
category
"Category Parser"
cost_center
"Cost Center"
}
}
default
{
...
...
@@ -256,6 +283,9 @@ ad_proc -public im_csv_import_guess_parser {
"im_category_tree"
{
return
[
list
"category"
$category
_type
]
}
"im_cost_center_tree"
{
return
[
list
"cost_center"
""
]
}
default
{
# Default: No specific parser
return
[
list
""
""
]
...
...
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