Skip to content

Commit 2cdabea

Browse files
committed
last SearchOption : "Next escalation level"
which is in fact "older due time" 🤷
1 parent ee45c20 commit 2cdabea

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/Ticket.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2522,6 +2522,8 @@ public function rawSearchOptions()
25222522
'computation' => self::generateSLAOLAComputation('time_to_own'),
25232523
];
25242524

2525+
// Minimal OLA/SLA TTO/TTR due time
2526+
// @todo label is wrong, nothing to do with escalation level, and nothing to do with future (can give date in the past)
25252527
$max_date = new QueryExpression('99999999');
25262528
$tab[] = [
25272529
'id' => '188',
@@ -2532,33 +2534,31 @@ public function rawSearchOptions()
25322534
'usehaving' => true,
25332535
'maybefuture' => true,
25342536
'massiveaction' => false,
2535-
// Get least value from TTO/TTR fields:
2537+
// Get the minimal date
2538+
// SLA
25362539
// - use TTO fields only if ticket not already taken into account,
25372540
// - use TTR fields only if ticket not already solved,
2541+
// OLA
2542+
// - no check, we rely on field value.
2543+
//
25382544
// - replace NULL or not kept values with 99999999 to be sure that they will not be returned by the LEAST function,
25392545
// - replace 99999999 by empty string to keep only valid values.
2540-
'computation' => QueryFunction::replace(
2546+
'computation' => QueryFunction::replace(
25412547
expression: QueryFunction::least([
25422548
QueryFunction::if(
25432549
condition: ['TABLE.takeintoaccount_delay_stat' => ['<=', 0]],
25442550
true_expression: QueryFunction::coalesce(['TABLE.time_to_own', $max_date]),
25452551
false_expression: $max_date
25462552
),
2547-
QueryFunction::if(
2548-
condition: ['TABLE.takeintoaccount_delay_stat' => ['<=', 0]],
2549-
true_expression: QueryFunction::coalesce(['TABLE.internal_time_to_own', $max_date]), // @todoseb trouver solution ou dégager, avec un MAX comme generateSLAOLAComputation() - est-ce qu'on a encore besoin ou la table est clean maintenant ? + ne pas se base sur takeintoaccount_delay_stat
2550-
false_expression: $max_date
2551-
),
2553+
QueryFunction::coalesce([
2554+
new QueryExpression((new QuerySubQuery(['FROM' => Item_Ola::getTable(), 'SELECT' => QueryFunction::min('due_time')]))->getQuery())
2555+
, $max_date
2556+
]),
25522557
QueryFunction::if(
25532558
condition: ['TABLE.solvedate' => null],
25542559
true_expression: QueryFunction::coalesce(['TABLE.time_to_resolve', $max_date]),
25552560
false_expression: $max_date
25562561
),
2557-
QueryFunction::if(
2558-
condition: ['TABLE.solvedate' => null],
2559-
true_expression: QueryFunction::coalesce(['TABLE.internal_time_to_resolve', $max_date]), // @todoseb trouver solution ou dégager, avec un MAX comme generateSLAOLAComputation() - est-ce qu'on a encore besoin ou la table est clean maintenant ? + ne pas se base sur takeintoaccount_delay_stat
2560-
false_expression: $max_date
2561-
),
25622562
]),
25632563
search: new QueryExpression($DB::quoteValue($max_date)),
25642564
replace: new QueryExpression($DB::quoteValue(''))

0 commit comments

Comments
 (0)