Skip to content

Commit

Permalink
search: Child Thread Relation
Browse files Browse the repository at this point in the history
This addresses issue 5959 where `TicketThread / Last Message` and
`TicketThread / Last Response` appear twice in the Advanced Search available
Fields. This is due to the joins/relationships automatically being added to
searchable fields. In this case, searching TicketThread will search the
Parent and Child Threads so there is no need for two separate options. This
adds a new property called `searchable` (set to false) to the `child_thread`
relation in the Ticket class. In addition, this adds a check when generating
the searchable fields that skips the relation if the `searchable` property
is `false`.
  • Loading branch information
JediKev committed Sep 24, 2021
1 parent 4842f6f commit 08785f9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion include/class.queue.php
Expand Up @@ -381,7 +381,8 @@ static function getSearchableFields($base, $recurse=2,
$exclude[$base] = 1;
foreach ($base::getMeta('joins') as $path=>$j) {
$fc = $j['fkey'][0];
if (isset($exclude[$fc]) || $j['list'])
if (isset($exclude[$fc]) || $j['list']
|| (isset($j['searchable']) && !$j['searchable']))
continue;
foreach (static::getSearchableFields($fc, $recurse-1,
true, $exclude)
Expand Down
1 change: 1 addition & 0 deletions include/class.ticket.php
Expand Up @@ -88,6 +88,7 @@ class Ticket extends VerySimpleModel
'ticket_id' => 'TicketThread.object_id',
"'C'" => 'TicketThread.object_type',
),
'searchable' => false,
'null' => true,
),
'cdata' => array(
Expand Down

0 comments on commit 08785f9

Please sign in to comment.