Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/CommonITILTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -1160,6 +1160,7 @@ public static function rawSearchOptionsToAdd($itemtype = null)
'name' => __('Duration'),
'datatype' => 'timestamp',
'massiveaction' => false,
'splititems' => true,
'forcegroupby' => true,
'joinparams' => [
'jointype' => 'child',
Expand All @@ -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',
Expand Down Expand Up @@ -1222,6 +1224,7 @@ public static function rawSearchOptionsToAdd($itemtype = null)
'datatype' => 'datetime',
'maybefuture' => true,
'massiveaction' => false,
'splititems' => true,
'forcegroupby' => true,
'joinparams' => [
'jointype' => 'child',
Expand All @@ -1237,6 +1240,7 @@ public static function rawSearchOptionsToAdd($itemtype = null)
'datatype' => 'datetime',
'maybefuture' => true,
'massiveaction' => false,
'splititems' => true,
'forcegroupby' => true,
'joinparams' => [
'jointype' => 'child',
Expand Down
68 changes: 37 additions & 31 deletions src/Glpi/Search/Provider/SQLProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,18 @@ public static function getSelectCriteria(string $itemtype, int $ID, bool $meta =
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 = [
Expand Down Expand Up @@ -6409,6 +6421,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"]) {
Expand All @@ -6417,10 +6434,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'])) {
Expand Down Expand Up @@ -6455,11 +6468,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++) {
Expand Down Expand Up @@ -6511,9 +6519,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 = "<span class='text-nowrap'>$out</span>";
Expand All @@ -6526,9 +6534,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 = "<span class='text-nowrap'>$out</span>";
Expand All @@ -6546,14 +6554,16 @@ public static function giveItem(

$out = '';
for ($k = 0; $k < $data[$ID]['count']; $k++) {
$out .= (empty($out) ? '' : '<br>')
. \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 = "<span class='text-nowrap'>$out</span>";
return $out;
Expand All @@ -6563,12 +6573,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 .= "<a href='mailto:" . $mail . "'>" . $mail;
$out .= "</a>";
}
Expand Down Expand Up @@ -6597,7 +6607,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 (
Expand All @@ -6619,7 +6629,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 (
Expand All @@ -6641,7 +6651,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']);
Expand All @@ -6658,7 +6668,7 @@ public static function giveItem(
continue;
}
if ($count_display) {
$out .= Search::LBBR;
$out .= $separate;
}
$count_display++;
if ($obj = getItemForItemtype($itemtype_name)) {
Expand Down Expand Up @@ -6706,10 +6716,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']);

Expand Down