Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
best-practical
rt-extension-sla
Commits
b62a1c0f
Commit
b62a1c0f
authored
Apr 19, 2012
by
Ruslan Zakirov
Browse files
new CallBusinessHours method
one entry point into business hours calls
parent
20f84bdf
Changes
1
Hide whitespace changes
Inline
Side-by-side
lib/RT/Extension/SLA.pm
View file @
b62a1c0f
...
...
@@ -326,6 +326,14 @@ sub BusinessHours {
return
$res
;
}
sub
CalcBusinessHours
{
my
$self
=
shift
;
my
$meta
=
shift
;
my
$method
=
shift
;
my
$bhours
=
$self
->
BusinessHours
(
$meta
->
{'
BusinessHours
'}
);
return
$bhours
->
$method
(
@
_
);
}
sub
Agreement
{
my
$self
=
shift
;
my
%args
=
(
Level
=>
undef
,
Type
=>
'
Response
',
Time
=>
undef
,
@
_
);
...
...
@@ -349,8 +357,7 @@ sub Agreement {
}
if
(
$args
{'
Time
'}
and
my
$tmp
=
$meta
->
{'
OutOfHours
'}{
$args
{'
Type
'}
}
)
{
my
$bhours
=
$self
->
BusinessHours
(
$meta
->
{'
BusinessHours
'}
);
if
(
$bhours
->
first_after
(
$args
{'
Time
'}
)
!=
$args
{'
Time
'}
)
{
if
(
$self
->
CalcBusinessHours
(
$meta
,
first_after
=>
$args
{'
Time
'}
)
!=
$args
{'
Time
'}
)
{
foreach
(
qw(RealMinutes BusinessMinutes)
)
{
next
unless
$tmp
->
{
$_
};
$res
{
$_
}
||=
0
;
...
...
@@ -373,8 +380,10 @@ sub Due {
my
$res
=
$args
{'
Time
'};
if
(
defined
$agreement
->
{'
BusinessMinutes
'}
)
{
my
$bhours
=
$self
->
BusinessHours
(
$agreement
->
{'
BusinessHours
'}
);
$res
=
$bhours
->
add_seconds
(
$res
,
60
*
$agreement
->
{'
BusinessMinutes
'}
);
$res
=
$self
->
CalcBusinessHours
(
$agreement
,
add_seconds
=>
$res
,
60
*
$agreement
->
{'
BusinessMinutes
'},
);
}
$res
+=
60
*
$agreement
->
{'
RealMinutes
'}
if
defined
$agreement
->
{'
RealMinutes
'};
...
...
@@ -391,8 +400,9 @@ sub Starts {
return
$args
{'
Time
'}
if
$agreement
->
{'
StartImmediately
'};
my
$bhours
=
$self
->
BusinessHours
(
$agreement
->
{'
BusinessHours
'}
);
return
$bhours
->
first_after
(
$args
{'
Time
'}
);
return
$self
->
CalcBusinessHours
(
$agreement
,
first_after
=>
$args
{'
Time
'},
);
}
sub
GetCustomField
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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