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
4ce41328
Commit
4ce41328
authored
Oct 06, 2020
by
Frank Bergmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Support for a "company" field when uploading users
parent
14d76c9b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
1 deletion
+24
-1
intranet-csv-import-procs.tcl
tcl/intranet-csv-import-procs.tcl
+1
-0
import-person.tcl
www/import-person.tcl
+23
-1
No files found.
tcl/intranet-csv-import-procs.tcl
View file @
4ce41328
...
...
@@ -133,6 +133,7 @@ ad_proc -public im_csv_import_guess_person { } {} {
{
vacation_days_per_year
"Vacation Days per Year"
number
""
}
{
vacation_balance
"Vacation Balance"
number
""
}
{
profiles
"Profiles"
no_change
""
}
{
company
"Company"
no_change
""
}
{
password
"Password"
no_change
""
}
}
return
$mapping
...
...
www/import-person.tcl
View file @
4ce41328
...
...
@@ -201,6 +201,7 @@ foreach csv_line_fields $values_list_of_lists {
# Group memberships
set profiles ""
set company ""
set password ""
# To Do:
...
...
@@ -449,16 +450,37 @@ foreach csv_line_fields $values_list_of_lists {
wa_country_code = :wa_country_code ,
note = :note
where user_id = :user_id
"
"
db_dml sql
$sql
if
{
$ns
_write_p
}
{
ns_write
"<li>Going to update the user's employee data
\n
"
}
# Deal with
"password"
field:
# Set the user's password if it was provided
if
{
""
ne
$password
}
{
if
{
$ns
_write_p
}
{
ns_write
"<li>Going to update the user's password</li>"
}
ad_change_password
$user
_id
$password
}
# Deal with
"company"
field:
# Search for a suitable company and add the user to the company
if
{
""
ne
$company
}
{
if
{
$ns
_write_p
}
{
ns_write
"<li>Going to add user to company '
$company
'</li>"
}
set company_id
""
if
{
""
eq
$company
_id
}
{
set company_id
[
db_string company_path
"select min(company_id) from im_companies where lower(trim(company_path)) = lower(trim(:company))"
-default
""
]
}
if
{
""
eq
$company
_id
}
{
set company_id
[
db_string company_name
"select min(company_id) from im_companies where lower(trim(company_name)) = lower(trim(:company))"
-default
""
]
}
if
{
""
eq
$company
_id
}
{
if
{
$ns
_write_p
}
{
ns_write
"<li><font color=brown>Warning: Did not find company name or path equal to: '
$company
'</font></li>"
}
}
else
{
if
{
$ns
_write_p
}
{
ns_write
"<li>Adding user to company: '
$company
'</li>"
}
im_biz_object_add_role
$user
_id
$company
_id 1300
}
}
###
# Assign users to profiles
...
...
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