diff --git a/src/CommonITILTask.php b/src/CommonITILTask.php
index 44e2c5f99a8..127b9b8b1af 100644
--- a/src/CommonITILTask.php
+++ b/src/CommonITILTask.php
@@ -1160,6 +1160,7 @@ public static function rawSearchOptionsToAdd($itemtype = null)
'name' => __('Duration'),
'datatype' => 'timestamp',
'massiveaction' => false,
+ 'splititems' => true,
'forcegroupby' => true,
'joinparams' => [
'jointype' => 'child',
@@ -1174,6 +1175,7 @@ public static function rawSearchOptionsToAdd($itemtype = null)
'name' => _n('Date', 'Dates', 1),
'datatype' => 'datetime',
'massiveaction' => false,
+ 'splititems' => true,
'forcegroupby' => true,
'joinparams' => [
'jointype' => 'child',
@@ -1222,6 +1224,7 @@ public static function rawSearchOptionsToAdd($itemtype = null)
'datatype' => 'datetime',
'maybefuture' => true,
'massiveaction' => false,
+ 'splititems' => true,
'forcegroupby' => true,
'joinparams' => [
'jointype' => 'child',
@@ -1237,6 +1240,7 @@ public static function rawSearchOptionsToAdd($itemtype = null)
'datatype' => 'datetime',
'maybefuture' => true,
'massiveaction' => false,
+ 'splititems' => true,
'forcegroupby' => true,
'joinparams' => [
'jointype' => 'child',
diff --git a/src/Glpi/Search/Provider/SQLProvider.php b/src/Glpi/Search/Provider/SQLProvider.php
index f04de77ed1b..b3177a4b06f 100644
--- a/src/Glpi/Search/Provider/SQLProvider.php
+++ b/src/Glpi/Search/Provider/SQLProvider.php
@@ -490,9 +490,22 @@ public static function getSelectCriteria(string $itemtype, int $ID, bool $meta =
case "glpi_itilfollowups.content":
case "glpi_tickettasks.content":
case "glpi_changetasks.content":
+ case "glpi_problemtasks.content":
case "glpi_tickettasks.state":
case "glpi_changetasks.state":
case "glpi_problemtasks.state":
+ case "glpi_tickettasks.is_private":
+ case "glpi_changetasks.is_private":
+ case "glpi_problemtasks.is_private":
+ case "glpi_tickettasks.actiontime":
+ case "glpi_changetasks.actiontime":
+ case "glpi_problemtasks.actiontime":
+ case "glpi_tickettasks.begin":
+ case "glpi_changetasks.begin":
+ case "glpi_problemtasks.begin":
+ case "glpi_tickettasks.end":
+ case "glpi_changetasks.end":
+ case "glpi_problemtasks.end":
if (is_subclass_of($itemtype, CommonITILObject::class)) {
// force ordering by date desc
$SELECT = [
@@ -6409,6 +6422,11 @@ public static function giveItem(
$unit = $so['unit'];
}
+ $separate = Search::LBBR;
+ if (isset($so['splititems']) && $so['splititems']) {
+ $separate = Search::LBHR;
+ }
+
// Preformat items
if (isset($so["datatype"])) {
switch ($so["datatype"]) {
@@ -6417,10 +6435,6 @@ public static function giveItem(
$out = "";
$count_display = 0;
- $separate = Search::LBBR;
- if (isset($so['splititems']) && $so['splititems']) {
- $separate = Search::LBHR;
- }
for ($k = 0; $k < $data[$ID]['count']; $k++) {
if (isset($data[$ID][$k]['id'])) {
@@ -6455,11 +6469,6 @@ public static function giveItem(
return $out;
case "text":
- $separate = Search::LBBR;
- if (isset($so['splititems']) && $so['splititems']) {
- $separate = Search::LBHR;
- }
-
$out = '';
$count_display = 0;
for ($k = 0; $k < $data[$ID]['count']; $k++) {
@@ -6511,9 +6520,9 @@ public static function giveItem(
is_null($data[$ID][$k]['name'])
&& isset($so['emptylabel']) && $so['emptylabel']
) {
- $out .= (empty($out) ? '' : Search::LBBR) . \htmlescape($so['emptylabel']);
+ $out .= (empty($out) ? '' : $separate) . \htmlescape($so['emptylabel']);
} else {
- $out .= (empty($out) ? '' : Search::LBBR) . \htmlescape(Html::convDate($data[$ID][$k]['name']));
+ $out .= (empty($out) ? '' : $separate) . \htmlescape(Html::convDate($data[$ID][$k]['name']));
}
}
$out = "$out";
@@ -6526,9 +6535,9 @@ public static function giveItem(
is_null($data[$ID][$k]['name'])
&& isset($so['emptylabel']) && $so['emptylabel']
) {
- $out .= (empty($out) ? '' : Search::LBBR) . \htmlescape($so['emptylabel']);
+ $out .= (empty($out) ? '' : $separate) . \htmlescape($so['emptylabel']);
} else {
- $out .= (empty($out) ? '' : Search::LBBR) . \htmlescape(Html::convDateTime($data[$ID][$k]['name']));
+ $out .= (empty($out) ? '' : $separate) . \htmlescape(Html::convDateTime($data[$ID][$k]['name']));
}
}
$out = "$out";
@@ -6546,14 +6555,16 @@ public static function giveItem(
$out = '';
for ($k = 0; $k < $data[$ID]['count']; $k++) {
- $out .= (empty($out) ? '' : '
')
- . \htmlescape(
- Html::timestampToString(
- $data[$ID][$k]['name'],
- $withseconds,
- $withdays
- )
- );
+ if ($k > 0) {
+ $out .= $separate;
+ }
+ $out .= \htmlescape(
+ Html::timestampToString(
+ $data[$ID][$k]['name'],
+ $withseconds,
+ $withdays
+ )
+ );
}
$out = "$out";
return $out;
@@ -6563,12 +6574,12 @@ public static function giveItem(
$count_display = 0;
for ($k = 0; $k < $data[$ID]['count']; $k++) {
if ($count_display) {
- $out .= Search::LBBR;
+ $out .= $separate;
}
$count_display++;
if (!empty($data[$ID][$k]['name'])) {
$mail = \htmlescape($data[$ID][$k]['name']);
- $out .= (empty($out) ? '' : Search::LBBR);
+ $out .= (empty($out) ? '' : $separate);
$out .= "" . $mail;
$out .= "";
}
@@ -6597,7 +6608,7 @@ public static function giveItem(
for ($k = 0; $k < $data[$ID]['count']; $k++) {
if (strlen(trim((string) $data[$ID][$k]['name'])) > 0) {
if ($count_display) {
- $out .= Search::LBBR;
+ $out .= $separate;
}
$count_display++;
if (
@@ -6619,7 +6630,7 @@ public static function giveItem(
for ($k = 0; $k < $data[$ID]['count']; $k++) {
if (strlen(trim((string) $data[$ID][$k]['name'])) > 0) {
if ($count_display) {
- $out .= Search::LBBR;
+ $out .= $separate;
}
$count_display++;
if (
@@ -6641,7 +6652,7 @@ public static function giveItem(
for ($k = 0; $k < $data[$ID]['count']; $k++) {
if (strlen(trim((string) $data[$ID][$k]['name'])) > 0) {
if ($count_display) {
- $out .= Search::LBBR;
+ $out .= $separate;
}
$count_display++;
$out .= Dropdown::getYesNo($data[$ID][$k]['name']);
@@ -6658,7 +6669,7 @@ public static function giveItem(
continue;
}
if ($count_display) {
- $out .= Search::LBBR;
+ $out .= $separate;
}
$count_display++;
if ($obj = getItemForItemtype($itemtype_name)) {
@@ -6706,10 +6717,6 @@ public static function giveItem(
// Manage items with need group by / group_concat
$out = "";
$count_display = 0;
- $separate = Search::LBBR;
- if (isset($so['splititems']) && $so['splititems']) {
- $separate = Search::LBHR;
- }
$aggregate = (isset($so['aggregate']) && $so['aggregate']);