Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
intranet-timesheet2
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
1
Merge Requests
1
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-timesheet2
Commits
e667ac41
Commit
e667ac41
authored
Apr 17, 2024
by
Frank Bergmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Absence interval: Now also accepting localized units
parent
ef249116
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
+10
-4
intranet-absences-procs.tcl
tcl/intranet-absences-procs.tcl
+10
-4
No files found.
tcl/intranet-absences-procs.tcl
View file @
e667ac41
...
...
@@ -1061,22 +1061,28 @@ ad_proc -public im_absence_formatted_duration_to_days {
Examples: '1 day', '4 hours', '1'
(
=one day
)
, '0.5'
(
=half a day
)
}
{
set days_formatted_1
[
string
trim
[
string
tolower
$days
_formatted
]]
set days_formatted_2
[
string
map
{
days d day d hours h hour h
}
$days
_formatted_1
]
set map_2
[
list
days d day d hours h hour h
]
set days_formatted_2
[
string
map
$map
_2
$days
_formatted_1
]
# Also accept localized names for day, days, hour or hours
set map_3
[
list
[
_ calendar.days
]
d
[
_ intranet-core.Day
]
d
[
_ calendar.Hours
]
h
[
_ intranet-core.Hour
]
h
]
set map_3
[
string
tolower
$map
_3
]
set days_formatted_3
[
string
map
$map
_3
$days
_formatted_2
]
set days
""
if
{[
regexp
{
^
(
.+
)
d
}
$days
_formatted_
2
match day_string
]}
{
if
{[
regexp
{
^
(
.+
)
d
}
$days
_formatted_
3
match day_string
]}
{
catch
{
set days
[
expr
1.0 *
[
string
trim
$day
_string
]]
}
}
if
{[
regexp
{
^
(
.+
)
h
}
$days
_formatted_
2
match hour_string
]}
{
if
{[
regexp
{
^
(
.+
)
h
}
$days
_formatted_
3
match hour_string
]}
{
catch
{
set days
[
expr
[
string
trim
$hour
_string
]
/ 8.0
]
}
}
if
{
""
eq
$days
}
{
catch
{
set days
[
expr
1.0 *
$days
_formatted_
2
]
set days
[
expr
1.0 *
$days
_formatted_
3
]
}
}
...
...
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